diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index 888bf81360..c3e7c6466a 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -28,12 +28,10 @@ jobs: - if: matrix.os == 'macos-11' name: Build - Release (MacOS) run: | - cd openssl - meson setup builddir --buildtype=release - meson compile -C builddir - cd .. + bash openssl/build-universal.sh mkdir -p builddir cd builddir + cp -r ../openssl/subprojects/openssl-3.0.2/generated-config/archs/darwin64-arm64-cc/asm/include ../openssl/subprojects/openssl-3.0.2 cp -r ../openssl/subprojects/openssl-3.0.2/generated-config/archs/darwin64-x86_64-cc/asm/include ../openssl/subprojects/openssl-3.0.2 cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=bundle -DENABLE_CRYPTO=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" cmake --build . --config Release -- -j8 diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a023c03685..63ac64e55f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -11,15 +11,16 @@ "windows": { "command": [ "cd openssl;", - "meson setup builddir --buildtype=release -Dmt=enabled;", + "meson setup builddir --buildtype=release -Dmt=disabled;", "meson compile -C builddir;", "cd ..;", "mkdir -force builddir;", "cd builddir;", "cp -r -force ../openssl/subprojects/openssl-3.0.2/generated-config/archs/VC-WIN64A/no-asm/include ../openssl/subprojects/openssl-3.0.2;", - "cmake .. -DCMAKE_INSTALL_PREFIX=bundle -DENABLE_CRYPTO=ON -DBUILD_SHARED_LIBS=OFF -DPOCO_MT=ON;", + "cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=bundle -DENABLE_CRYPTO=ON -DBUILD_SHARED_LIBS=OFF -DPOCO_MT=OFF -DCMAKE_CXX_FLAGS=\"-DPOCO_NO_AUTOMATIC_LIBS -DPOCO_STATIC\";", "cmake --build . --config Release;", - "cmake --build . --target install" + "cmake --build . --target install;", + "python3 ../scripts/bundle.py win release_md done" ], "problemMatcher": { "base": "$msCompile", @@ -31,16 +32,15 @@ }, "osx": { "command": [ - "cd openssl &&", - "meson setup builddir --buildtype=release &&", - "meson compile -C builddir &&", - "cd .. &&", + "bash openssl/build-universal.sh &&", "mkdir -p builddir &&", "cd builddir &&", + "cp -r ../openssl/subprojects/openssl-3.0.2/generated-config/archs/darwin64-arm64-cc/asm/include ../openssl/subprojects/openssl-3.0.2 &&", "cp -r ../openssl/subprojects/openssl-3.0.2/generated-config/archs/darwin64-x86_64-cc/asm/include ../openssl/subprojects/openssl-3.0.2 &&", - "cmake .. -DCMAKE_INSTALL_PREFIX=bundle -DENABLE_CRYPTO=ON -DBUILD_SHARED_LIBS=OFF &&", + "cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=bundle -DENABLE_CRYPTO=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_ARCHITECTURES=\"arm64;x86_64\" &&", "cmake --build . --config Release -- -j8 &&", - "cmake --build . --target install" + "cmake --build . --target install &&", + "python3 ../scripts/bundle.py mac release done" ], "problemMatcher": { "base": "$gcc", diff --git a/openssl/arm-build.txt b/openssl/arm-build.txt new file mode 100644 index 0000000000..60c3cf3e5d --- /dev/null +++ b/openssl/arm-build.txt @@ -0,0 +1,9 @@ +[host_machine] +system = 'darwin' +cpu_family = 'aarch64' +cpu = 'arm64' +endian = 'little' + +[binaries] +c = 'clang' +strip = 'strip' diff --git a/openssl/build-universal.sh b/openssl/build-universal.sh new file mode 100644 index 0000000000..61b67b7899 --- /dev/null +++ b/openssl/build-universal.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +DIR=$(cd `dirname $0` && pwd) +cd $DIR + +meson setup arm-build --buildtype=release --cross-file=arm-build.txt +meson compile -C arm-build + +meson setup x64-build --buildtype=release --cross-file=x64-build.txt +meson compile -C x64-build + +mkdir -p builddir/subprojects/openssl-3.0.2/libcrypto.a.p +mkdir -p builddir/subprojects/openssl-3.0.2/libssl.a.p + +lipo -create -output builddir/subprojects/openssl-3.0.2/libcrypto.a arm-build/subprojects/openssl-3.0.2/libcrypto.a x64-build/subprojects/openssl-3.0.2/libcrypto.a +lipo -create -output builddir/subprojects/openssl-3.0.2/libssl.a arm-build/subprojects/openssl-3.0.2/libssl.a x64-build/subprojects/openssl-3.0.2/libssl.a + +cd arm-build + +for filename in subprojects/openssl-3.0.2/libcrypto.a.p/*.o; do + if [ -f "../x64-build/$filename" ] + then + lipo -create -output ../builddir/$filename ../x64-build/$filename $filename + else + cp $filename ../builddir/$filename + fi +done + +for filename in subprojects/openssl-3.0.2/libssl.a.p/*.o; do + if [ -f "../x64-build/$filename" ] + then + lipo -create -output ../builddir/$filename ../x64-build/$filename $filename + else + cp $filename ../builddir/$filename + fi +done + +cd ../x64-build + +for filename in subprojects/openssl-3.0.2/libcrypto.a.p/*.o; do + if [ ! -f "../arm-build/$filename" ] + then + cp $filename ../builddir/$filename + fi +done + +for filename in subprojects/openssl-3.0.2/libssl.a.p/*.o; do + if [ ! -f "../arm-build/$filename" ] + then + cp $filename ../builddir/$filename + fi +done diff --git a/openssl/x64-build.txt b/openssl/x64-build.txt new file mode 100644 index 0000000000..6c610ff6cc --- /dev/null +++ b/openssl/x64-build.txt @@ -0,0 +1,9 @@ +[host_machine] +system = 'darwin' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' + +[binaries] +c = 'clang' +strip = 'strip'