From a030fd39f012b22705704905c534f4fda4ffdc55 Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Thu, 19 Dec 2024 00:44:25 -0600 Subject: work --- init | 5 +++++ luaossl-git-0.rockspec | 46 ++++------------------------------------------ openssl.c.patch | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 42 deletions(-) create mode 100644 openssl.c.patch diff --git a/init b/init index 12517f5..7d3a888 100755 --- a/init +++ b/init @@ -1,7 +1,12 @@ #!/bin/sh -ex cp luaossl-packaging/luaossl-git-0.rockspec luaossl +tar -xvzf include.tar.gz +mkdir lib +cp libcrypto.a lib cd luaossl +git apply /root/luaossl-packaging/openssl.c.patch + luarocks config variables.CFLAGS " $CFLAGS" luarocks make --pack-binary-rock luaossl-git-0.rockspec obj="luaossl-git.$(luarocks config arch).rock" diff --git a/luaossl-git-0.rockspec b/luaossl-git-0.rockspec index dc740b7..1727cf8 100644 --- a/luaossl-git-0.rockspec +++ b/luaossl-git-0.rockspec @@ -24,16 +24,6 @@ external_dependencies = { header = "openssl/crypto.h"; library = "crypto"; }; - platforms = { - windows = { - OPENSSL = { - library = "libeay32" - }; - CRYPTO = { - library = "ssleay32" - }; - } - }; } build = { type = "builtin"; @@ -87,42 +77,15 @@ build = { ["openssl.x509.verify_param"] = "src/openssl.x509.verify_param.lua"; }; platforms = { - -- Unixy systems need to link with pthreads and libm. - -- We also define _GNU_SOURCE in the hope for extra functionality - unix = { - modules = { - ["_openssl"] = { - libraries = { - nil, nil; - "pthread"; - "m"; - }; - defines = { - nil, nil, nil; - "_GNU_SOURCE"; - } - }; - }; - }; - -- Only linux needs to link with libdl - linux = { - modules = { - ["_openssl"] = { - libraries = { - nil, nil, nil, nil; - "dl"; - }; - }; - }; - }; -- On windows, OpenSSL libraries are named differently -- We also have to guide autoguess around some incorrect assumptions - win32 = { + linux = { modules = { ["_openssl"] = { libraries = { - "libeay32"; - "ssleay32"; + nil, nil, + "pthread"; + "dl"; "ws2_32"; "advapi32"; "kernel32"; @@ -130,7 +93,6 @@ build = { defines = { nil, nil, nil; "HAVE_SYS_PARAM_H=0"; - "HAVE_DLFCN_H=0"; -- Need to set version to at least Vista to get inet_pton "_WIN32_WINNT=0x0600"; }; diff --git a/openssl.c.patch b/openssl.c.patch new file mode 100644 index 0000000..efc28f6 --- /dev/null +++ b/openssl.c.patch @@ -0,0 +1,46 @@ +diff --git a/src/openssl.c b/src/openssl.c +index fd7d28e..5e89f2a 100644 +--- a/src/openssl.c ++++ b/src/openssl.c +@@ -40,13 +40,21 @@ + #include /* ssize_t pid_t */ + #include /* struct timeval gettimeofday(2) */ + #include /* struct stat stat(2) */ ++#ifdef _WIN32_WINNT ++#include /* struct in_addr */ ++#include ++#include /* AF_INET AF_INET6 */ ++#include /* struct in6_addr */ ++#include /* inet_pton */ ++#else + #include /* AF_INET AF_INET6 */ + #include /* RUSAGE_SELF struct rusage getrusage(2) */ + #include /* struct utsname uname(3) */ +-#include /* O_RDONLY O_CLOEXEC open(2) */ +-#include /* close(2) getpid(2) */ + #include /* struct in_addr struct in6_addr */ + #include /* inet_pton(3) */ ++#endif ++#include /* O_RDONLY O_CLOEXEC open(2) */ ++#include /* close(2) getpid(2) */ + #include /* pthread_mutex_init(3) pthread_mutex_lock(3) pthread_mutex_unlock(3) */ + #include /* dladdr(3) dlopen(3) */ + +@@ -10082,8 +10090,6 @@ error:; + struct { + struct timeval tv; + pid_t pid; +- struct rusage ru; +- struct utsname un; + uintptr_t aslr; + #if defined __APPLE__ + uint64_t mt; +@@ -10094,8 +10100,6 @@ error:; + + gettimeofday(&junk.tv, NULL); + junk.pid = getpid(); +- getrusage(RUSAGE_SELF, &junk.ru); +- uname(&junk.un); + junk.aslr = (uintptr_t)&strcpy ^ (uintptr_t)&randL_stir; + #if defined __APPLE__ + junk.mt = mach_absolute_time(); -- cgit v1.2.3-55-g6feb