aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/macos_test.yml7
-rw-r--r--CMakeLists.txt9
-rw-r--r--apps/nc/CMakeLists.txt10
-rw-r--r--apps/ocspcheck/CMakeLists.txt12
-rw-r--r--apps/openssl/CMakeLists.txt17
-rw-r--r--crypto/CMakeLists.txt3
-rw-r--r--include/CMakeLists.txt7
-rwxr-xr-xscripts/test83
-rw-r--r--ssl/CMakeLists.txt3
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tls/CMakeLists.txt3
11 files changed, 108 insertions, 47 deletions
diff --git a/.github/workflows/macos_test.yml b/.github/workflows/macos_test.yml
index 83a1b35..d7509d6 100644
--- a/.github/workflows/macos_test.yml
+++ b/.github/workflows/macos_test.yml
@@ -6,13 +6,12 @@ jobs:
6 build-native: 6 build-native:
7 strategy: 7 strategy:
8 matrix: 8 matrix:
9 os: [macos-12, macos-11] 9 os: [macos-13, macos-12]
10 compiler: [clang, gcc] 10 arch: [arm64, x86_64]
11 runs-on: ${{ matrix.os }} 11 runs-on: ${{ matrix.os }}
12 continue-on-error: false 12 continue-on-error: false
13 env: 13 env:
14 CC: ${{ matrix.compiler }} 14 ARCH: ${{ matrix.arch }}
15 ARCH: native
16 name: ${{ matrix.compiler }} - ${{ matrix.os }} 15 name: ${{ matrix.compiler }} - ${{ matrix.os }}
17 steps: 16 steps:
18 - name: Install packages for macos 17 - name: Install packages for macos
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7847830..b8863c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -306,6 +306,15 @@ if(HAVE_NETINET_IP_H)
306 add_definitions(-DHAVE_NETINET_IP_H) 306 add_definitions(-DHAVE_NETINET_IP_H)
307endif() 307endif()
308 308
309# This isn't ready for universal binaries yet, since we do conditional
310# compilation based on the architecture, but this makes cross compiling for a
311# single architecture work on macOS at least.
312#
313# Don't set CMAKE_OSX_ARCHITECTURES to more than a single value for now.
314if(APPLE)
315 set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}")
316endif()
317
309if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(aarch64|arm64)") 318if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(aarch64|arm64)")
310 set(HOST_AARCH64 true) 319 set(HOST_AARCH64 true)
311elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm") 320elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
diff --git a/apps/nc/CMakeLists.txt b/apps/nc/CMakeLists.txt
index bd59211..ffd68e5 100644
--- a/apps/nc/CMakeLists.txt
+++ b/apps/nc/CMakeLists.txt
@@ -36,8 +36,14 @@ else()
36endif() 36endif()
37 37
38add_executable(nc ${NC_SRC}) 38add_executable(nc ${NC_SRC})
39target_include_directories(nc PUBLIC ../../include) 39target_include_directories(nc
40target_include_directories(nc PRIVATE . ./compat ../../include/compat) 40 PRIVATE
41 .
42 ./compat
43 ../../include/compat
44 PUBLIC
45 ../../include
46 ${CMAKE_BINARY_DIR}/include)
41target_link_libraries(nc ${LIBTLS_LIBS}) 47target_link_libraries(nc ${LIBTLS_LIBS})
42 48
43if(ENABLE_NC) 49if(ENABLE_NC)
diff --git a/apps/ocspcheck/CMakeLists.txt b/apps/ocspcheck/CMakeLists.txt
index 2dddb6e..43eebdf 100644
--- a/apps/ocspcheck/CMakeLists.txt
+++ b/apps/ocspcheck/CMakeLists.txt
@@ -8,9 +8,9 @@ set(
8 8
9check_function_exists(memmem HAVE_MEMMEM) 9check_function_exists(memmem HAVE_MEMMEM)
10if(HAVE_MEMMEM) 10if(HAVE_MEMMEM)
11 add_definitions(-DHAVE_MEMMEM) 11 add_definitions(-DHAVE_MEMMEM)
12else() 12else()
13 set(OCSPCHECK_SRC ${OCSPCHECK_SRC} compat/memmem.c) 13 set(OCSPCHECK_SRC ${OCSPCHECK_SRC} compat/memmem.c)
14endif() 14endif()
15 15
16if(NOT "${OPENSSLDIR}" STREQUAL "") 16if(NOT "${OPENSSLDIR}" STREQUAL "")
@@ -20,8 +20,12 @@ else()
20endif() 20endif()
21 21
22add_executable(ocspcheck ${OCSPCHECK_SRC}) 22add_executable(ocspcheck ${OCSPCHECK_SRC})
23target_include_directories(ocspcheck PUBLIC ../../include) 23target_include_directories(ocspcheck
24target_include_directories(ocspcheck PRIVATE . ./compat ../../include/compat) 24 PRIVATE
25 ../../include/compat
26 PUBLIC
27 ../../include
28 ${CMAKE_BINARY_DIR}/include)
25target_link_libraries(ocspcheck tls ${OPENSSL_LIBS}) 29target_link_libraries(ocspcheck tls ${OPENSSL_LIBS})
26 30
27if(ENABLE_LIBRESSL_INSTALL) 31if(ENABLE_LIBRESSL_INSTALL)
diff --git a/apps/openssl/CMakeLists.txt b/apps/openssl/CMakeLists.txt
index 437c0db..efea217 100644
--- a/apps/openssl/CMakeLists.txt
+++ b/apps/openssl/CMakeLists.txt
@@ -61,15 +61,20 @@ if(WIN32)
61endif() 61endif()
62 62
63if(CMAKE_SYSTEM_NAME MATCHES "Darwin") 63if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
64 check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) 64 check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
65 if(NOT HAVE_CLOCK_GETTIME) 65 if(NOT HAVE_CLOCK_GETTIME)
66 set(OPENSSL_SRC ${OPENSSL_SRC} compat/clock_gettime_osx.c) 66 set(OPENSSL_SRC ${OPENSSL_SRC} compat/clock_gettime_osx.c)
67 endif() 67 endif()
68endif() 68endif()
69 69
70add_executable(openssl ${OPENSSL_SRC}) 70add_executable(openssl ${OPENSSL_SRC})
71target_include_directories(openssl PUBLIC ../../include) 71target_include_directories(openssl
72target_include_directories(openssl PRIVATE . ../../include/compat) 72 PRIVATE
73 .
74 ../../include/compat
75 PUBLIC
76 ../../include
77 ${CMAKE_BINARY_DIR}/include)
73target_link_libraries(openssl ${OPENSSL_LIBS}) 78target_link_libraries(openssl ${OPENSSL_LIBS})
74 79
75if(ENABLE_LIBRESSL_INSTALL) 80if(ENABLE_LIBRESSL_INSTALL)
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
index 707424c..84eb894 100644
--- a/crypto/CMakeLists.txt
+++ b/crypto/CMakeLists.txt
@@ -997,7 +997,8 @@ target_include_directories(crypto_obj
997 x509 997 x509
998 ../include/compat 998 ../include/compat
999 PUBLIC 999 PUBLIC
1000 ../include) 1000 ../include
1001 ${CMAKE_BINARY_DIR}/include)
1001 1002
1002if(HOST_AARCH64) 1003if(HOST_AARCH64)
1003 target_include_directories(crypto_obj PRIVATE bn/arch/aarch64/) 1004 target_include_directories(crypto_obj PRIVATE bn/arch/aarch64/)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 44ab86b..ca81ee8 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -4,7 +4,10 @@ if(ENABLE_LIBRESSL_INSTALL)
4 PATTERN "CMakeLists.txt" EXCLUDE 4 PATTERN "CMakeLists.txt" EXCLUDE
5 PATTERN "compat" EXCLUDE 5 PATTERN "compat" EXCLUDE
6 PATTERN "pqueue.h" EXCLUDE 6 PATTERN "pqueue.h" EXCLUDE
7 PATTERN "Makefile*" EXCLUDE) 7 PATTERN "Makefile*" EXCLUDE
8 PATTERN "arch" EXCLUDE)
9 install(FILES ${CMAKE_BINARY_DIR}/include/openssl/opensslconf.h
10 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/openssl")
8endif(ENABLE_LIBRESSL_INSTALL) 11endif(ENABLE_LIBRESSL_INSTALL)
9 12
10if(HOST_AARCH64) 13if(HOST_AARCH64)
@@ -28,4 +31,4 @@ elseif(HOST_SPARC64)
28elseif(HOST_X86_64) 31elseif(HOST_X86_64)
29 file(READ arch/amd64/opensslconf.h OPENSSLCONF) 32 file(READ arch/amd64/opensslconf.h OPENSSLCONF)
30endif() 33endif()
31file(WRITE openssl/opensslconf.h "${OPENSSLCONF}") 34file(WRITE ${CMAKE_BINARY_DIR}/include/openssl/opensslconf.h "${OPENSSLCONF}")
diff --git a/scripts/test b/scripts/test
index f1fdd83..97e316e 100755
--- a/scripts/test
+++ b/scripts/test
@@ -10,46 +10,77 @@ if type apt-get >/dev/null 2>&1; then
10 sudo apt-get install -y cmake ninja-build 10 sudo apt-get install -y cmake ninja-build
11fi 11fi
12 12
13# generate source tree
13./autogen.sh 14./autogen.sh
14 15
15if [ "x$ARCH" = "xnative" ]; then 16if [ "$ARCH" = "" ]; then
17 ARCH=`uname -m`
18fi
19
20# test macOS
21if [ `uname` = "Darwin" ]; then
16 # test autotools 22 # test autotools
17 ./configure 23 ./configure
18 make -j 4 distcheck
19 24
20 # make distribution 25 # make distribution
21 make dist 26 make -j 4 distcheck
27
28 # test cmake
22 tar zxvf libressl-*.tar.gz 29 tar zxvf libressl-*.tar.gz
23 cd libressl-* 30 cd libressl-*
24 mkdir build-static
25 mkdir build-shared
26
27 cd build-static
28 31
29 # test cmake and ninja 32 (
30 if [ `uname` = "Darwin" ]; then 33 mkdir build-static
31 cmake -DENABLE_ASM=${ENABLE_ASM} .. 34 cd build-static
35 cmake -DCMAKE_OSX_ARCHITECTURES=$ARCH ..
32 make -j 4 36 make -j 4
33 make test 37 if [ "$ARCH" = "x86_64" ]; then
38 make test
39 fi
40 )
34 41
35 cd ../build-shared 42 (
36 cmake -DBUILD_SHARED_LIBS=ON -DENABLE_ASM=${ENABLE_ASM} .. 43 mkdir build-shared
44 cd build-shared
45 cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=$ARCH ..
37 make -j 4 46 make -j 4
38 make test 47 if [ "$ARCH" = "x86_64" ]; then
39 else 48 make test
49 fi
50 )
51
52# assuming Linux below
53elif [ "$ARCH" = "native" ]; then
54 # test autotools
55 ./configure
56
57 # make distribution
58 make -j 4 distcheck
59
60 tar zxvf libressl-*.tar.gz
61 cd libressl-*
62
63
64 # test cmake and ninja
65 (
66 mkdir build-static
67 cd build-static
40 cmake -GNinja -DENABLE_ASM=${ENABLE_ASM} .. 68 cmake -GNinja -DENABLE_ASM=${ENABLE_ASM} ..
41 ninja -j 4 69 ninja
42 ninja test 70 ninja test
71 )
43 72
44 cd ../build-shared 73 (
74 mkdir build-shared
75 cd build-shared
45 cmake -GNinja -DBUILD_SHARED_LIBS=ON -DENABLE_ASM=${ENABLE_ASM} .. 76 cmake -GNinja -DBUILD_SHARED_LIBS=ON -DENABLE_ASM=${ENABLE_ASM} ..
46 ninja -j 4 77 ninja
47 ninja test 78 ninja test
48 fi 79 )
49 80
50elif [ "x$ARCH" = "xmingw32" -o "x$ARCH" = "xmingw64" ]; then 81elif [ "$ARCH" = "mingw32" -o "$ARCH" = "mingw64" ]; then
51 CPU=i686 82 CPU=i686
52 if [ "x$ARCH" = "xmingw64" ]; then 83 if [ "$ARCH" = "mingw64" ]; then
53 CPU=x86_64 84 CPU=x86_64
54 fi 85 fi
55 86
@@ -75,10 +106,10 @@ elif [ "x$ARCH" = "xmingw32" -o "x$ARCH" = "xmingw64" ]; then
75 ninja -j 4 106 ninja -j 4
76 ) 107 )
77 108
78elif [ "x$ARCH" = "xarm32" -o "x$ARCH" = "xarm64" ]; then 109elif [ "$ARCH" = "arm32" -o "$ARCH" = "arm64" ]; then
79 sudo apt-get install -y qemu-user-static binfmt-support 110 sudo apt-get install -y qemu-user-static binfmt-support
80 111
81 if [ "x$ARCH" = "xarm32" ]; then 112 if [ "$ARCH" = "arm32" ]; then
82 sudo apt-get install -y g++-arm-linux-gnueabihf 113 sudo apt-get install -y g++-arm-linux-gnueabihf
83 sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ 114 sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/
84 ./configure --host=arm-linux-gnueabihf 115 ./configure --host=arm-linux-gnueabihf
@@ -92,10 +123,10 @@ elif [ "x$ARCH" = "xarm32" -o "x$ARCH" = "xarm64" ]; then
92 123
93 file apps/openssl/.libs/openssl 124 file apps/openssl/.libs/openssl
94 125
95elif [ "x$ARCH" = "xmips32" -o "x$ARCH" = "xmips64" ]; then 126elif [ "$ARCH" = "mips32" -o "$ARCH" = "mips64" ]; then
96 sudo apt-get install -y qemu-user-static binfmt-support 127 sudo apt-get install -y qemu-user-static binfmt-support
97 128
98 if [ "x$ARCH" = "xmips32" ]; then 129 if [ "$ARCH" = "mips32" ]; then
99 sudo apt-get install -y g++-mips-linux-gnu 130 sudo apt-get install -y g++-mips-linux-gnu
100 sudo ln -sf /usr/mipsel-linux-gnu/lib/ld.so.1 /lib/ 131 sudo ln -sf /usr/mipsel-linux-gnu/lib/ld.so.1 /lib/
101 ./configure --host=mipsel-linux-gnu 132 ./configure --host=mipsel-linux-gnu
@@ -109,7 +140,7 @@ elif [ "x$ARCH" = "xmips32" -o "x$ARCH" = "xmips64" ]; then
109 140
110 file apps/openssl/.libs/openssl 141 file apps/openssl/.libs/openssl
111 142
112elif [ "x$ARCH" = "xandroid" ]; then 143elif [ "$ARCH" = "android" ]; then
113 export TC_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake 144 export TC_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
114 145
115 # set target API level and architecture 146 # set target API level and architecture
diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt
index f5d52f7..88e7bbd 100644
--- a/ssl/CMakeLists.txt
+++ b/ssl/CMakeLists.txt
@@ -69,7 +69,8 @@ target_include_directories(ssl_obj
69 ../crypto/bio 69 ../crypto/bio
70 ../include/compat 70 ../include/compat
71 PUBLIC 71 PUBLIC
72 ../include) 72 ../include
73 ${CMAKE_BINARY_DIR}/include)
73 74
74add_library(bs_obj OBJECT ${BS_SRC}) 75add_library(bs_obj OBJECT ${BS_SRC})
75target_include_directories(bs_obj 76target_include_directories(bs_obj
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 36c68a9..9edb613 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -13,6 +13,7 @@ include_directories(
13 ../apps/openssl 13 ../apps/openssl
14 ../apps/openssl/compat 14 ../apps/openssl/compat
15 ../include 15 ../include
16 ${CMAKE_BINARY_DIR}/include
16 ../include/compat 17 ../include/compat
17) 18)
18 19
diff --git a/tls/CMakeLists.txt b/tls/CMakeLists.txt
index 62dde63..5bc6208 100644
--- a/tls/CMakeLists.txt
+++ b/tls/CMakeLists.txt
@@ -45,7 +45,8 @@ target_include_directories(tls_obj
45 . 45 .
46 ../include/compat 46 ../include/compat
47 PUBLIC 47 PUBLIC
48 ../include) 48 ../include
49 ${CMAKE_BINARY_DIR}/include)
49 50
50add_library(tls $<TARGET_OBJECTS:tls_obj> $<TARGET_OBJECTS:ssl_obj> 51add_library(tls $<TARGET_OBJECTS:tls_obj> $<TARGET_OBJECTS:ssl_obj>
51 $<TARGET_OBJECTS:crypto_obj> empty.c) 52 $<TARGET_OBJECTS:crypto_obj> empty.c)