885adf3a2f7f226f8f44fd5de9413bea82ee0d24
[mirror_edk2.git] / CryptoPkg / Library / OpensslLib / process_files.sh
1 #!/bin/sh
2 #
3 # This script runs the OpenSSL Configure script, then processes the
4 # resulting file list into our local OpensslLib.inf and also takes
5 # a copy of opensslconf.h.
6 #
7 # This only needs to be done once by a developer when updating to a
8 # new version of OpenSSL (or changing options, etc.). Normal users
9 # do not need to do this, since the results are stored in the EDK2
10 # git repository for them.
11
12 OPENSSL_PATH=$(sed -n '/DEFINE OPENSSL_PATH/{s/.* \(openssl-[0-9.]*[a-z]*\)[[:space:]]*/\1/ p}' OpensslLib.inf)
13
14 if ! cd "${OPENSSL_PATH}" ; then
15 echo "Cannot change to OpenSSL directory \"${OPENSSL_PATH}\""
16 exit 1
17 fi
18
19 ./Configure UEFI \
20 no-asm \
21 no-bf \
22 no-camellia \
23 no-capieng \
24 no-cast \
25 no-cms \
26 no-deprecated \
27 no-dgram \
28 no-dsa \
29 no-dynamic-engine \
30 no-ec \
31 no-ecdh \
32 no-ecdsa \
33 no-engine \
34 no-engines \
35 no-err \
36 no-filenames \
37 no-fp-api \
38 no-hw \
39 no-idea \
40 no-jpake \
41 no-krb5 \
42 no-locking \
43 no-mdc2 \
44 no-posix-io \
45 no-pqueue \
46 no-rc2 \
47 no-rcs \
48 no-rfc3779 \
49 no-ripemd \
50 no-scrypt \
51 no-sct \
52 no-seed \
53 no-sha0 \
54 no-sock \
55 no-srp \
56 no-ssl \
57 no-stdio \
58 no-threads \
59 no-ts \
60 no-ui \
61 no-whirlpool \
62 || exit 1
63
64 make files
65 cd -
66
67 function filelist ()
68 {
69 echo '1,/# Autogenerated files list starts here/p'
70 echo '/# Autogenerated files list ends here/,$p'
71 echo '/# Autogenerated files list starts here/a\'
72
73 while read LINE; do
74 case "$LINE" in
75 RELATIVE_DIRECTORY=*)
76 eval "$LINE"
77 ;;
78 LIBSRC=*)
79 LIBSRC=$(echo "$LINE" | sed s/^LIBSRC=//)
80 if [ "$RELATIVE_DIRECTORY" != "ssl" ]; then
81 for FILE in $LIBSRC; do
82 if [ "$FILE" != "b_print.c" ]; then
83 echo -e ' $(OPENSSL_PATH)/'$RELATIVE_DIRECTORY/$FILE\\r\\
84 fi
85 done
86 fi
87 ;;
88 esac
89 done
90 echo -e \\r
91 }
92
93 filelist < "${OPENSSL_PATH}/MINFO" | sed -n -f - -i OpensslLib.inf
94
95 # We can tell Windows users to put this back manually if they can't run
96 # Configure. For now, until the git repository is fixed to store things
97 # sanely, also convert to DOS line-endings
98 unix2dos -n "${OPENSSL_PATH}/crypto/opensslconf.h" opensslconf.h