]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/OpensslLib/process_files.sh
CryptoPkg/OpensslLib: Automatically configure OpenSSL and generate file list
[mirror_edk2.git] / CryptoPkg / Library / OpensslLib / process_files.sh
diff --git a/CryptoPkg/Library/OpensslLib/process_files.sh b/CryptoPkg/Library/OpensslLib/process_files.sh
new file mode 100644 (file)
index 0000000..6247ac9
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/sh\r
+#\r
+# This script runs the OpenSSL Configure script, then processes the\r
+# resulting file list into our local OpensslLib.inf and also takes\r
+# a copy of opensslconf.h.\r
+#\r
+# This only needs to be done once by a developer when updating to a\r
+# new version of OpenSSL (or changing options, etc.). Normal users\r
+# do not need to do this, since the results are stored in the EDK2\r
+# git repository for them.\r
+\r
+OPENSSL_PATH=$(sed -n '/DEFINE OPENSSL_PATH/{s/.* \(openssl-[0-9.]*[a-z]*\)[[:space:]]*/\1/ p}' OpensslLib.inf)\r
+\r
+if ! cd "${OPENSSL_PATH}" ; then\r
+    echo "Cannot change to OpenSSL directory \"${OPENSSL_PATH}\""\r
+    exit 1\r
+fi\r
+\r
+./Configure UEFI \\r
+       no-asm \\r
+       no-bf \\r
+       no-camellia \\r
+       no-capieng \\r
+       no-cast \\r
+       no-cms \\r
+       no-deprecated \\r
+       no-dgram \\r
+       no-dsa \\r
+       no-dynamic-engine \\r
+       no-ec \\r
+       no-ecdh \\r
+       no-ecdsa \\r
+       no-engine \\r
+       no-engines \\r
+       no-err \\r
+       no-filenames \\r
+       no-fp-api \\r
+       no-hw \\r
+       no-idea \\r
+       no-jpake \\r
+       no-krb5 \\r
+       no-locking \\r
+       no-mdc2 \\r
+       no-posix-io \\r
+       no-pqueue \\r
+       no-rc2 \\r
+       no-rcs \\r
+       no-rfc3779 \\r
+       no-ripemd \\r
+       no-scrypt \\r
+       no-sct \\r
+       no-seed \\r
+       no-sha0 \\r
+       no-sock \\r
+       no-srp \\r
+       no-ssl \\r
+       no-stdio \\r
+       no-threads \\r
+       no-ts \\r
+       no-ui \\r
+       no-whirlpool \\r
+    || exit 1\r
+\r
+make files\r
+cd -\r
+\r
+function filelist ()\r
+{\r
+    echo '1,/# Autogenerated files list starts here/p'\r
+    echo '/# Autogenerated files list ends here/,$p'\r
+    echo '/# Autogenerated files list starts here/a\'\r
+\r
+    while read LINE; do\r
+       case "$LINE" in\r
+           RELATIVE_DIRECTORY=*)\r
+               eval "$LINE"\r
+               ;;\r
+           LIBSRC=*)\r
+               LIBSRC=$(echo "$LINE" | sed s/^LIBSRC=//)\r
+               if [ "$RELATIVE_DIRECTORY" != "ssl" ]; then\r
+                   for FILE in $LIBSRC; do\r
+                       if [ "$FILE" != "b_print.c" ]; then\r
+                           echo -e '  $(OPENSSL_PATH)/'$RELATIVE_DIRECTORY/$FILE\\r\\\r
+                       fi\r
+                   done\r
+               fi\r
+               ;;\r
+       esac\r
+    done\r
+    echo -e \\r\r
+}\r
+\r
+filelist < "${OPENSSL_PATH}/MINFO" |  sed -n -f - -i OpensslLib.inf\r
+\r
+# We can tell Windows users to put this back manually if they can't run\r
+# Configure.\r
+cp "${OPENSSL_PATH}/crypto/opensslconf.h" .\r