Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
517710b
Add Prebuild workflow
MarcusTomlinson Jun 14, 2022
07fe6c4
Use cmake in tasks
MarcusTomlinson Jun 14, 2022
742a5d2
Buidling from tasks
MarcusTomlinson Jun 14, 2022
d6c639c
Windows building from tasks
MarcusTomlinson Jun 14, 2022
d000a73
Update Prebuild workflow
MarcusTomlinson Jun 15, 2022
52f0e14
Fix FindOpenSSL.cmake
MarcusTomlinson Jun 15, 2022
42744ad
Fix openssl paths
MarcusTomlinson Jun 15, 2022
3524d87
Add 'mt' option to openssl
MarcusTomlinson Jun 15, 2022
122c6a4
Set openssl paths explicitly in FindOpenSSL.cmake
MarcusTomlinson Jun 15, 2022
542e5be
Update bundle
MarcusTomlinson Jun 16, 2022
02c85bc
Fix Windows bundling
MarcusTomlinson Jun 16, 2022
68c36a1
Forgot "done" in macOS CI
MarcusTomlinson Jun 16, 2022
d5c0f34
Try -DCMAKE_CXX_FLAGS="-DPOCO_NO_AUTOMATIC_LIBS"
MarcusTomlinson Jun 16, 2022
85a4671
Bundle meson config
MarcusTomlinson Jun 16, 2022
0a47e69
Fix Upload step
MarcusTomlinson Jun 16, 2022
fe43e9a
Build /MT and /MD Windows libs
MarcusTomlinson Jun 16, 2022
ce4ffe8
Define POCO_STATIC
MarcusTomlinson Jun 16, 2022
c3163a5
Flesh out meson.build
MarcusTomlinson Jun 17, 2022
7222ebe
Add "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15"
MarcusTomlinson Jun 17, 2022
2972cc0
Disable _legacyProvider
MarcusTomlinson Jun 17, 2022
541bba9
Add #pragma comment(lib)'s for win dependencies
MarcusTomlinson Jun 17, 2022
884966e
Ignore Poco header warnings
MarcusTomlinson Jun 19, 2022
ae187a0
Add *_md versions of all libs
MarcusTomlinson Jun 19, 2022
11de63e
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
MarcusTomlinson Jul 3, 2022
7bf2e37
Build openssl universal binaries
MarcusTomlinson Jul 3, 2022
657267e
Combine arch specific objects into others.o
MarcusTomlinson Jul 3, 2022
431d302
libcrypto_lib -> libcrypto_dep
MarcusTomlinson Jul 3, 2022
f3d9607
Bundle DataODBC & DataSQLite
MarcusTomlinson Jul 11, 2022
0008fad
Ignore signed/unsigned mismatch warnings
MarcusTomlinson Jul 12, 2022
7d52f66
Add Linux build
MarcusTomlinson Sep 9, 2022
7ca0fa4
Merge branch 'master' into prebuild
MarcusTomlinson Oct 2, 2023
476cc86
trigger CI/CD
MarcusTomlinson Jan 30, 2024
410d05a
Build for macOS 10.15
MarcusTomlinson Jan 30, 2024
b8925af
Build for macOS 11.1
MarcusTomlinson Jan 30, 2024
4d018fe
Run CI on Ubuntu 20.04
MarcusTomlinson Feb 2, 2024
81b336b
Trigger CI
MarcusTomlinson Feb 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Prebuild

on:
push:
branches: [ prebuild ]

jobs:
prebuild:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, ubuntu-20.04, windows-2022]

steps:
- if: matrix.os == 'windows-2022'
name: Configure MSVC (Windows)
uses: ilammy/msvc-dev-cmd@v1

- if: matrix.os == 'macos-11'
name: Configure Xcode (MacOS)
run: |
sudo xcode-select -s /Applications/Xcode_12.4.app/Contents/Developer

- name: Install Meson and Ninja
run: |
pip3 install --upgrade meson ninja

- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- if: matrix.os == 'macos-11'
name: Build - Release (MacOS)
run: |
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
cmake --build . --target install
python3 ../scripts/bundle.py mac release done

- if: matrix.os == 'ubuntu-20.04'
name: Build - Release (Linux)
run: |
cd openssl
meson setup builddir --buildtype=release
meson compile -C builddir
cd ..
mkdir -p builddir
cd builddir
cp -r ../openssl/subprojects/openssl-3.0.2/generated-config/archs/linux-x86_64/asm/include ../openssl/subprojects/openssl-3.0.2
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=bundle -DENABLE_CRYPTO=ON -DBUILD_SHARED_LIBS=OFF
cmake --build . --config Release -- -j8
cmake --build . --target install
python3 ../scripts/bundle.py linux release done

- if: matrix.os == 'windows-2022'
name: Build - Release /MT (Windows)
run: |
cd openssl
meson setup builddir --buildtype=release -Dmt=enabled
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_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=bundle -DENABLE_CRYPTO=ON -DBUILD_SHARED_LIBS=OFF -DPOCO_MT=ON -DCMAKE_CXX_FLAGS="-DPOCO_NO_AUTOMATIC_LIBS -DPOCO_STATIC"
cmake --build . --config Release
cmake --build . --target install
python3 ../scripts/bundle.py win release_mt

- if: matrix.os == 'windows-2022'
name: Build - Release /MD (Windows)
run: |
rm -r builddir
rm -r openssl/builddir

cd openssl
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_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
python3 ../scripts/bundle.py win release_md done

- name: Upload
uses: ncipollo/release-action@v1.10.0
with:
allowUpdates: true
replacesArtifacts: true
tag: build-${{ github.run_number }}
name: Build ${{ github.run_number }}
artifacts: scripts/poco-*.zip
artifactContentType: application/zip
commit: ${{ github.sha }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ cmake-build/
stage/
releases/

# OpenSSL #
###########
builddir
openssl/subprojects/openssl-*
openssl/subprojects/packagecache
scripts/bundle

# vim #
#######
*.orig
Expand Down
55 changes: 55 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"windows": {
"command": [
"cd openssl;",
"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_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;",
"python3 ../scripts/bundle.py win release_md done"
],
"problemMatcher": {
"base": "$msCompile",
"fileLocation": [
"relative",
"${workspaceFolder}/builddir"
]
}
},
"osx": {
"command": [
"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 &&",
"cmake --build . --target install &&",
"python3 ../scripts/bundle.py mac release done"
],
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceFolder}/builddir/"
]
}
}
}
]
}
10 changes: 5 additions & 5 deletions Crypto/src/OpenSSLInitializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ void OpenSSLInitializer::initialize()
_defaultProvider = OSSL_PROVIDER_load(NULL, "default");
if (!_defaultProvider) throw CryptoException("Failed to load OpenSSL default provider");
}
if (!_legacyProvider)
{
_legacyProvider = OSSL_PROVIDER_load(NULL, "legacy");
if (!_legacyProvider) throw CryptoException("Failed to load OpenSSL legacy provider");
}
// if (!_legacyProvider)
// {
// _legacyProvider = OSSL_PROVIDER_load(NULL, "legacy");
// if (!_legacyProvider) throw CryptoException("Failed to load OpenSSL legacy provider");
// }
#endif
}
}
Expand Down
5 changes: 5 additions & 0 deletions Foundation/include/Poco/Foundation.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#ifndef Foundation_Foundation_INCLUDED
#define Foundation_Foundation_INCLUDED

#if defined(_WIN32)
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "iphlpapi.lib")
#pragma comment(lib, "crypt32.lib")
#endif

//
// Include library configuration
Expand Down
13 changes: 13 additions & 0 deletions cmake/FindOpenSSL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
set(OPENSSL_SSL_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/openssl/builddir/subprojects/openssl-3.0.2/libssl.a)
set(OPENSSL_CRYPTO_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/openssl/builddir/subprojects/openssl-3.0.2/libcrypto.a)
set(OPENSSL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/openssl/subprojects/openssl-3.0.2/include)

add_library(OpenSSL::SSL STATIC IMPORTED)
set_property(TARGET OpenSSL::SSL PROPERTY IMPORTED_LOCATION ${OPENSSL_SSL_LIBRARY})
set_property(TARGET OpenSSL::SSL PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIR})

add_library(OpenSSL::Crypto STATIC IMPORTED)
set_property(TARGET OpenSSL::Crypto PROPERTY IMPORTED_LOCATION ${OPENSSL_CRYPTO_LIBRARY})
set_property(TARGET OpenSSL::Crypto PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIR})

set(OPENSSL_FOUND TRUE)
9 changes: 9 additions & 0 deletions openssl/arm-build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[host_machine]
system = 'darwin'
cpu_family = 'aarch64'
cpu = 'arm64'
endian = 'little'

[binaries]
c = 'clang'
strip = 'strip'
15 changes: 15 additions & 0 deletions openssl/build-universal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/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

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
18 changes: 18 additions & 0 deletions openssl/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
project('openssl', 'c',
default_options: [
'warning_level=0',
'werror=false'
]
)

if host_machine.system() == 'windows'
if get_option('mt').enabled()
add_global_arguments('/MT', language: 'c')
else
add_global_arguments('/MD', language: 'c')
endif
elif host_machine.system() == 'darwin'
add_global_arguments('-mmacosx-version-min=10.15', language: 'c')
endif

openssl = subproject('openssl', default_options: ['default_library=static'])
1 change: 1 addition & 0 deletions openssl/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('mt', type : 'feature', value : 'enabled')
14 changes: 14 additions & 0 deletions openssl/subprojects/openssl.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[wrap-file]
directory = openssl-3.0.2
source_url = https://www.openssl.org/source/openssl-3.0.2.tar.gz
source_filename = openssl-3.0.2.tar.gz
source_hash = 98e91ccead4d4756ae3c9cde5e09191a8e586d9f4d50838e7ec09d6411dfdb63
patch_filename = openssl_3.0.2-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.2-1/get_patch
patch_hash = 762ab4ea94d02178d6a1d3eb63409c2c4d61315d358391cdac62df15211174d4

[provide]
libcrypto = libcrypto_dep
libssl = libssl_dep
openssl = openssl_dep

9 changes: 9 additions & 0 deletions openssl/x64-build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[host_machine]
system = 'darwin'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[binaries]
c = 'clang'
strip = 'strip'
75 changes: 75 additions & 0 deletions scripts/bundle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import os
import platform
import shutil
import sys
import glob

if len(sys.argv) < 3:
print('Usage: python bundle.py os config')
exit(1)

opsys = sys.argv[1]
config = sys.argv[2]

curdir = os.path.dirname(os.path.realpath(__file__))
srcdir = curdir + '/..'
bundledir = curdir + '/bundle'
configdir = bundledir + '/poco/' + opsys + '/' + config

# bundle openssl includes

if os.path.exists(bundledir + '/poco/' + opsys + '/include'):
shutil.rmtree(bundledir + '/poco/' + opsys + '/include')

shutil.copytree(srcdir + '/openssl/subprojects/openssl-3.0.2/include', bundledir + '/poco/' + opsys + '/include')

# bundle poco includes

shutil.copytree(srcdir + '/builddir/bundle/include/Poco', bundledir + '/poco/' + opsys + '/include/Poco')

# bundle openssl libs

if os.path.exists(configdir):
shutil.rmtree(configdir)

os.makedirs(configdir)

shutil.copy2(srcdir + '/openssl/builddir/subprojects/openssl-3.0.2/libcrypto.a', configdir)
shutil.copy2(srcdir + '/openssl/builddir/subprojects/openssl-3.0.2/libssl.a', configdir)

# bundle poco objects

components = ['ActiveRecord', 'Crypto', 'Data', 'Data/ODBC', 'Data/SQLite', 'Encodings', 'Foundation', 'JSON', 'JWT', 'MongoDB',
'Net', 'NetSSL_OpenSSL', 'PageCompiler', 'Redis', 'Util', 'XML', 'Zip']

for component in components:
if '/' in component:
component_base = component.replace('/', '')
else:
component_base = component.split('_')[0]

os.makedirs(configdir + '/Poco/' + component_base)

if platform.system() == 'Windows':
if 'release' in config:
files = glob.iglob(os.path.join(srcdir + '/builddir/' + component + '/' + component_base + '.dir/Release/*.obj'))
else:
files = glob.iglob(os.path.join(srcdir + '/builddir/' + component + '/' + component_base + '.dir/Debug/*.obj'))
else:
files = glob.iglob(os.path.join(srcdir + '/builddir/' + component + '/CMakeFiles/' + component_base + '.dir/src/*.o'))

for file in files:
if os.path.isfile(file):
shutil.copy2(file, configdir + '/Poco/' + component_base)

# patch

shutil.copy2(curdir + '/patch/globo', bundledir + '/poco/globo')
shutil.copy2(curdir + '/patch/meson.build', bundledir + '/poco/meson.build')

# zip

bundlezip = curdir + '/poco-' + opsys

if len(sys.argv) > 3:
shutil.make_archive(bundlezip, 'zip', bundledir)
16 changes: 16 additions & 0 deletions scripts/patch/globo
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import glob
import platform
import sys

config = sys.argv[1]
component = sys.argv[2]

if platform.system() == 'Windows':
for i in glob.glob('./win/' + config + '/' + component + '/*.obj'):
print(i)
elif platform.system() == 'Darwin':
for i in glob.glob('./mac/' + config + '/' + component + '/*.o'):
print(i)
else:
for i in glob.glob('./linux/' + config + '/' + component + '/*.o'):
print(i)
Loading