summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-13 19:39:41 +0800
committerErik Kundiman <erik@megapahit.org>2024-08-13 19:43:04 +0800
commitd9b7e392dd2777246e06f7816e6258aabfeecb6a (patch)
tree207bb99fc7680e3e697b18fff274ecfd7746ddcd
parent3d32b55509f531127bcc030942160ec6f341fcbf (diff)
Automatic OpenSSL download, build and installation
-rw-r--r--README.md32
-rw-r--r--indra/cmake/OpenSSL.cmake154
2 files changed, 155 insertions, 31 deletions
diff --git a/README.md b/README.md
index 1ecf951358..ce8c34089a 100644
--- a/README.md
+++ b/README.md
@@ -37,17 +37,11 @@ $ cd viewer
$ sudo port install cmake pkgconfig autoconf automake apr-util +universal boost +universal collada-dom +universal hunspell +universal freetype +universal jsoncpp +universal openjpeg +universal openssl11 +universal uriparser +universal libvorbis +universal xxhashlib
$ mkdir -p build/universal-apple-darwin`uname -r`/packages
$ cd ~/Downloads
-$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-darwin64-513145c.tar.zst -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-darwin64-de53f55.tar.zst
+$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-darwin64-513145c.tar.zst
$ cd -
$ cd ..
-$ git clone https://github.com/secondlife/3p-openssl
$ git clone https://github.com/secondlife/3p-curl
-$ cd 3p-openssl/openssl
-$ mkdir -p build/aarch64-apple-darwin`uname -r`
-$ cd build/aarch64-apple-darwin`uname -r`
-$ ../../Configure no-shared darwin64-arm64-cc
-$ make -j`sysctl -n hw.ncpu`
-$ cd ../../../../3p-curl/curl
+$ cd 3p-curl/curl
$ mkdir -p build/aarch64-apple-darwin`uname -r`
$ cd build/aarch64-apple-darwin`uname -r`
$ export CFLAGS="-arch arm64 -mmacosx-version-min=11.0 -std=c90"
@@ -58,10 +52,7 @@ $ sudo port activate openssl3
$ unset CFLAGS
$ cd ../../../../viewer/build/universal-apple-darwin`uname -r`/packages
$ tar xf ~/Downloads/curl-7.54.1-513145c-darwin64-513145c.tar.zst
-$ tar xf ~/Downloads/openssl-1.1.1q.de53f55-darwin64-de53f55.tar.zst
$ cd lib/release
-$ lipo ../../../../../../3p-openssl/openssl/build/aarch64-apple-darwin`uname -r`/libcrypto.a libcrypto.a -create -output libcrypto.a
-$ lipo ../../../../../../3p-openssl/openssl/build/aarch64-apple-darwin`uname -r`/libssl.a libssl.a -create -output libssl.a
$ lipo ../../../../../../3p-curl/curl/build/aarch64-apple-darwin`uname -r`/lib/.libs/libcurl.a libcurl.a -create -output libcurl.a
$ cd ../../..
$ export LL_BUILD="-O3 -gdwarf-2 -stdlib=libc++ -mmacosx-version-min=10.15 -iwithsysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -std=c++17 -fPIC -DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -DNDEBUG -DPIC -DLL_DARWIN=1"
@@ -76,11 +67,10 @@ $ open newview/Megapahit.app
```
$ mkdir -p build/`uname -m`-linux-gnu/packages
$ cd ~/Downloads
-$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-linux64-513145c.tar.zst -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-linux64-de53f55.tar.zst
+$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-linux64-513145c.tar.zst
$ cd -
$ cd build/`uname -m`-linux-gnu/packages
$ tar xf ~/Downloads/curl-7.54.1-513145c-linux64-513145c.tar.zst
-$ tar xf ~/Downloads/openssl-1.1.1q.de53f55-linux64-de53f55.tar.zst
$ cd ..
$ export LL_BUILD="-O3 -std=c++17 -fPIC -DLL_LINUX=1"
$ rm CMakeCache.txt
@@ -122,22 +112,6 @@ $ megapahit
### FreeBSD
```
-$ mkdir -p build/`uname -m`-unknown-freebsd14.1/packages
-$ cd ~/Downloads
-$ curl -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-linux64-de53f55.tar.zst
-$ cd -
-$ cd ..
-$ git clone https://github.com/secondlife/3p-openssl
-$ git clone https://github.com/secondlife/3p-curl
-$ cd 3p-openssl/openssl
-$ mkdir -p build/`uname -m`-unknown-freebsd14.1
-$ cd -p build/`uname -m`-unknown-freebsd14.1
-$ ../../config no-shared
-$ make -j`nproc`
-$ cd ../../../../viewer/build/`uname -m`-unknown-freebsd14.1/packages
-$ tar xf ~/Downloads/openssl-1.1.1q.de53f55-linux64-de53f55.tar.zst
-$ cp ../../../../3p-openssl/openssl/build/`uname -m`-unknown-freebsd14.1/lib*.a lib/release/
-$ cd ..
$ setenv LL_BUILD "-O3 -std=c++17 -fPIC"
$ sudo su -
# portmaster devel/cmake devel/pkgconf audio/freealut devel/apr1 devel/collada-dom x11-toolkits/fltk textproc/hunspell misc/meshoptimizer graphics/nanosvg graphics/openjpeg devel/sdl20 net/uriparser multimedia/vlc audio/libvorbis net/xmlrpc-epi devel/xxhash
diff --git a/indra/cmake/OpenSSL.cmake b/indra/cmake/OpenSSL.cmake
index 26508dc429..4481b3460f 100644
--- a/indra/cmake/OpenSSL.cmake
+++ b/indra/cmake/OpenSSL.cmake
@@ -4,8 +4,158 @@ include(Prebuilt)
include_guard()
add_library( ll::openssl INTERFACE IMPORTED )
-#use_system_binary(openssl)
-#use_prebuilt_binary(openssl)
+if (NOT USESYSTEMLIBS)
+use_system_binary(openssl)
+endif (NOT USESYSTEMLIBS)
+if (CMAKE_OSX_ARCHITECTURES MATCHES x86_64 OR LINUX OR NOT USESYSTEMLIBS)
+use_prebuilt_binary(openssl)
+elseif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/openssl_installed OR NOT ${openssl_installed} EQUAL 0)
+ if (NOT EXISTS ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55.tar.gz)
+ file(DOWNLOAD
+ https://github.com/secondlife/3p-openssl/archive/refs/tags/v1.1.1q.de53f55.tar.gz
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55.tar.gz
+ )
+ endif (NOT EXISTS ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55.tar.gz)
+ file(ARCHIVE_EXTRACT
+ INPUT ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55.tar.gz
+ DESTINATION ${CMAKE_BINARY_DIR}
+ )
+ if (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ set(ENV{CFLAGS} "-mmacosx-version-min=11.0")
+ execute_process(
+ COMMAND ./Configure no-shared darwin64-arm64-cc
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl
+ )
+ else (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ execute_process(
+ COMMAND ./config no-shared
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl
+ )
+ endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ execute_process(
+ COMMAND make -j${MAKE_JOBS}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl
+ RESULT_VARIABLE openssl_installed
+ )
+ if (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ unset(ENV{CFLAGS})
+ endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ file(
+ COPY
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/aes.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/bnerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/conf_api.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/dtls1.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/evperr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/obj_mac.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/pkcs12.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/rsa.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/stack.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/x509.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/asn1.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/buffer.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/conferr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/e_os2.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/hmac.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/objects.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/pkcs12err.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/rsaerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/store.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/x509_vfy.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/asn1_mac.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/buffererr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/crypto.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ebcdic.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/idea.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/objectserr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/pkcs7.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/safestack.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/storeerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/x509err.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/asn1err.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/camellia.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/cryptoerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ec.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/kdf.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ocsp.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/pkcs7err.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/seed.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/symhacks.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/x509v3.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/asn1t.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/cast.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ct.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ecdh.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/kdferr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ocsperr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/rand.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/sha.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/tls1.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/x509v3err.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/async.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/cmac.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/cterr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ecdsa.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/lhash.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/opensslconf.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/rand_drbg.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/srp.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ts.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/asyncerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/cms.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/des.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ecerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/md2.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/opensslv.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/randerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/srtp.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/tserr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/bio.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/cmserr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/dh.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/engine.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/md4.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ossl_typ.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/rc2.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ssl.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/txt_db.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/bioerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/comp.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/dherr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/engineerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/md5.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/pem.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/rc4.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ssl2.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ui.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/blowfish.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/comperr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/dsa.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/err.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/mdc2.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/pem2.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/rc5.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ssl3.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/uierr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/bn.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/conf.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/dsaerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/evp.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/modes.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/pemerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/ripemd.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/sslerr.h
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/whrlpool.h
+ DESTINATION ${LIBS_PREBUILT_DIR}/include/openssl
+ )
+ file(
+ COPY
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/libcrypto.a
+ ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/libssl.a
+ DESTINATION ${LIBS_PREBUILT_DIR}/lib/release
+ )
+ file(WRITE ${PREBUILD_TRACKING_DIR}/openssl_installed "${openssl_installed}")
+endif (CMAKE_OSX_ARCHITECTURES MATCHES x86_64 OR LINUX OR NOT USESYSTEMLIBS)
if (WINDOWS)
target_link_libraries(ll::openssl INTERFACE libssl libcrypto)
elseif (LINUX)