From 34d27b7c596aa120afa88d0c6db65f38b87799f1 Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Wed, 1 Nov 2023 01:37:18 +1300 Subject: [PATCH] MERGEBACK --- .github/workflows/wheels.yml | 2 +- configure.ac | 6 ---- setup.py | 2 +- src/amalgamation/windows_config/config.h | 37 +++++++----------------- tools/msvc/swig.bat | 2 +- 5 files changed, 13 insertions(+), 36 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index f32fc3298..82c73e1d6 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -20,7 +20,7 @@ jobs: CIBW_BEFORE_ALL_LINUX: yum install -y swig || apk add swig CIBW_BEFORE_ALL_MACOS: brew install gnu-sed swig automake CIBW_BEFORE_ALL_WINDOWS: choco install swig --version=3.0.12 --no-progress --allow-downgrade -y - CIBW_BEFORE_BUILD_WINDOWS: .\tools\msvc\wheel_preamble.bat + CIBW_BEFORE_BUILD_WINDOWS: .\tools\msvc\swig.bat CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair --only-plat -w {dest_dir} {wheel} LIBWALLY_DIR: "." SWIG_PATH: "C:\\ProgramData\\chocolatey\\lib\\swig\\tools\\install\\swigwin-3.0.12" diff --git a/configure.ac b/configure.ac index 13a01cfa0..71fee02da 100644 --- a/configure.ac +++ b/configure.ac @@ -212,12 +212,6 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(void){static int a[2];return *((int*)(( have_unaligned=1, have_unaligned=0, have_unaligned=0) AC_DEFINE_UNQUOTED([HAVE_UNALIGNED_ACCESS], [$have_unaligned], [Define if we have unaligned access]) -if test "x$is_osx" != "xyes"; then - # Assume we are using gcc (i.e. have this attribute) if cross-compiling - AC_COMPILE_IFELSE([AC_LANG_SOURCE([extern int foo(int) __attribute__((weak)); int main(void){return 0;}])], - [AC_DEFINE([HAVE_ATTRIBUTE_WEAK], 1, [Define if we have __attribute__((weak))])]) -fi - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[mmap(0,0,0,0,0,0)]])], [AC_DEFINE(HAVE_MMAP, 1, [Define if we have mmap])]) diff --git a/setup.py b/setup.py index 5a92df4a0..c0249ea6a 100644 --- a/setup.py +++ b/setup.py @@ -77,7 +77,7 @@ def call(args, cwd=abs_path): include_dirs=include_dirs, extra_compile_args=extra_compile_args, sources=[ - 'src/swig_python/swig_wrap.c' if is_windows else 'src/swig_python/swig_python_wrap.c', + 'src/swig_python/swig_python_wrap.c', 'src/amalgamation/combined.c', 'src/amalgamation/combined_ccan.c', 'src/amalgamation/combined_ccan2.c', diff --git a/src/amalgamation/windows_config/config.h b/src/amalgamation/windows_config/config.h index 312345559..454a73eca 100644 --- a/src/amalgamation/windows_config/config.h +++ b/src/amalgamation/windows_config/config.h @@ -1,36 +1,19 @@ #ifndef LIBWALLYCORE_CONFIG_H #define LIBWALLYCORE_CONFIG_H + +/* config.h for Windows. Assumes a little-endian intel-ish target */ #include -#define HAVE_ATTRIBUTE_WEAK 1 -#define HAVE_BIG_ENDIAN 0 -#define HAVE_BSWAP_64 0 -#define HAVE_BYTESWAP_H 0 -#define HAVE_DLFCN_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LITTLE_ENDIAN 1 -#define HAVE_MEMORY_H 1 -#define HAVE_MMAP 1 -#define HAVE_PTHREAD 1 -#define HAVE_PTHREAD_PRIO_INHERIT 1 -#define HAVE_PYTHON "2.7" -#define HAVE_STDINT_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_UNISTD_H 1 -#define STDC_HEADERS 1 -#define VERSION "0.6" -#if (!defined(_SSIZE_T_DECLARED)) && (!defined(_ssize_t)) && (!defined(ssize_t)) -#define ssize_t long long +#ifndef _WIN32 +#error windows_config/config.h is only intended for windows builds #endif -#define alignment_ok(p, n) ((size_t)(p) % (n) == 0) +#define HAVE_UNALIGNED_ACCESS 1 -void wally_clear(void *p, size_t len); +#if (!defined(_SSIZE_T_DECLARED)) && (!defined(_ssize_t)) && (!defined(ssize_t)) +#define ssize_t long long +#endif -#define CCAN_CLEAR_MEMORY(p, len) wally_clear(p, len) +#include "ccan_config.h" -#endif /*LIBWALLYCORE_CONFIG_H*/ +#endif /* LIBWALLYCORE_CONFIG_H */ diff --git a/tools/msvc/swig.bat b/tools/msvc/swig.bat index 5cd57dfc9..56c7b668b 100644 --- a/tools/msvc/swig.bat +++ b/tools/msvc/swig.bat @@ -1,5 +1,5 @@ REM You need to set SWIG_PATH to the location where the swig zip REM file is expanded to -%SWIG_PATH%\swig -python -Isrc -I%SWIG_PATH%\Lib\python -DBUILD_ELEMENTS=1 src\swig_python\swig.i +%SWIG_PATH%\swig -python -Isrc -I%SWIG_PATH%\Lib\python -DBUILD_ELEMENTS=1 src\swig_python\swig.i -o src\swig_python\swig_python_wrap.c copy src\swig_python\wallycore.py + src\swig_python\python_extra.py_in src\swig_python\wallycore\__init__.py /B del src\swig_python\wallycore.py