From 19dd107685eb6691d858c7f543cb0c2dfa8a4f15 Mon Sep 17 00:00:00 2001 From: Raed Rizqie Date: Sat, 29 Oct 2022 15:41:19 +0800 Subject: [PATCH 1/2] libtommath: fix building --- .../0001-makefile-enable-no-undefined.patch | 11 ---- mingw-w64-libtommath/PKGBUILD | 56 ++++++++----------- 2 files changed, 24 insertions(+), 43 deletions(-) delete mode 100644 mingw-w64-libtommath/0001-makefile-enable-no-undefined.patch diff --git a/mingw-w64-libtommath/0001-makefile-enable-no-undefined.patch b/mingw-w64-libtommath/0001-makefile-enable-no-undefined.patch deleted file mode 100644 index 76c128e43e..0000000000 --- a/mingw-w64-libtommath/0001-makefile-enable-no-undefined.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/makefile_include.mk -+++ b/makefile_include.mk -@@ -97,7 +97,7 @@ - ifeq ($(PLATFORM), Darwin) - LTM_CFLAGS += -Wno-nullability-completeness - endif --ifeq ($(PLATFORM), CYGWIN) -+ifneq ($(findstring $(PLATFORM),CYGWIN MINGW32 MINGW64 MSYS),) - LIBTOOLFLAGS += -no-undefined - endif - diff --git a/mingw-w64-libtommath/PKGBUILD b/mingw-w64-libtommath/PKGBUILD index d79e09aaf2..de320a171e 100644 --- a/mingw-w64-libtommath/PKGBUILD +++ b/mingw-w64-libtommath/PKGBUILD @@ -4,22 +4,17 @@ _realname=libtommath pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=1.2.0 -pkgrel=3 +pkgrel=4 pkgdesc="Highly optimized and portable routines for integer based number theoretic applications (mingw-w64)" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32') url="https://www.libtom.net/LibTomMath/" license=('custom') depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs") -makedepends=("${MINGW_PACKAGE_PREFIX}-cc" - "make") -options=('staticlibs' 'strip') -source=("https://github.com/libtom/libtommath/releases/download/v${pkgver}/ltm-${pkgver}.tar.xz"{,.asc} - "0001-makefile-enable-no-undefined.patch") -sha256sums=('b7c75eecf680219484055fcedd686064409254ae44bc31a96c5032843c0e18b1' - 'SKIP' - 'b770559d51381e078bc84c9162fc711e0e3ebe17b94bc073c00ab5051cf85546') -validpgpkeys=('C4386A237ED43A475541B9427B2CD0DD4BCFF59B') # Steffen Jaeckel +makedepends=("${MINGW_PACKAGE_PREFIX}-cc") +options=('strip') +source=("https://github.com/libtom/libtommath/releases/download/v${pkgver}/ltm-${pkgver}.tar.xz") +sha256sums=('b7c75eecf680219484055fcedd686064409254ae44bc31a96c5032843c0e18b1') prepare() { cd "${srcdir}/${_realname}-${pkgver}" @@ -27,40 +22,37 @@ prepare() { # Disable unnecessary warnings sed -e "s/ -Wsystem-headers//g" -e "s/ -Wshadow//g" -i makefile_include.mk - # https://github.com/libtom/libtommath/pull/506 - patch -Np1 -i "${srcdir}/0001-makefile-enable-no-undefined.patch" + # Build both shared and static library + sed -e "s/\$(LIBMAIN_S) test/\$(LIBMAIN_S) \$(LIBMAIN_D) test/g" -e "s/--export-all/--export-all-symbols/g" -i makefile.mingw + + # Disable static libgcc linking + sed -e "s/ -static-libgcc//g" -i makefile.mingw } build() { - cp -rf "${_realname}-${pkgver}" "build-${MINGW_CHOST}" - cd "${srcdir}/build-${MINGW_CHOST}" + cp -rf "${_realname}-${pkgver}" "build-${MSYSTEM}" + cd "${srcdir}/build-${MSYSTEM}" + + make -f makefile.mingw all \ + CC=${CC} PREFIX=${MINGW_PREFIX} - CFLAGS+=" -I${srcdir}/build-${MINGW_CHOST}" - CC="${MINGW_PREFIX}/bin/gcc" \ - PREFIX="${MINGW_PREFIX}" \ - make -f makefile.shared IGNORE_SPEED=1 } check() { - cd ${srcdir}/build-${MINGW_CHOST} + cd ${srcdir}/build-${MSYSTEM} - CC=${MINGW_PREFIX}/bin/gcc \ - make -f makefile.shared mtest + ./test.exe } package() { - cd ${srcdir}/build-${MINGW_CHOST} + cd ${srcdir}/build-${MSYSTEM} - CC="${MINGW_PREFIX}/bin/gcc" \ - PREFIX="${MINGW_PREFIX}" \ - make -f makefile.shared \ - DESTDIR=${pkgdir} \ - INSTALL_GROUP=root \ - LIBPATH=${MINGW_PREFIX}/lib \ - INCPATH=${MINGW_PREFIX}/include \ - DATAPATH=${MINGW_PREFIX}/share/doc/libtommath/pdf \ - install + mkdir -p ${pkgdir}${MINGW_PREFIX}/include + install -Dm755 libtommath.dll "${pkgdir}${MINGW_PREFIX}/bin/libtommath.dll" + install -Dm644 libtommath.a "${pkgdir}${MINGW_PREFIX}/lib/libtommath.a" + install -Dm644 libtommath.dll.a "${pkgdir}${MINGW_PREFIX}/lib/libtommath.dll.a" + install -Dm644 tommath*.h "${pkgdir}${MINGW_PREFIX}/include" + install -Dm644 doc/bn.pdf "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/bn.pdf" install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE" - chmod 644 ${pkgdir}${MINGW_PREFIX}/lib/libtommath{.dll,}.a } From 81d40781e0af4c49c98b94e05f95a811fc630d36 Mon Sep 17 00:00:00 2001 From: Raed Rizqie Date: Sat, 29 Oct 2022 19:30:11 +0800 Subject: [PATCH 2/2] libtomcrypt: fix building --- .../0001-makefile-enable-no-undefined.patch | 11 ----- mingw-w64-libtomcrypt/PKGBUILD | 49 +++++++++---------- 2 files changed, 23 insertions(+), 37 deletions(-) delete mode 100644 mingw-w64-libtomcrypt/0001-makefile-enable-no-undefined.patch diff --git a/mingw-w64-libtomcrypt/0001-makefile-enable-no-undefined.patch b/mingw-w64-libtomcrypt/0001-makefile-enable-no-undefined.patch deleted file mode 100644 index d32996396a..0000000000 --- a/mingw-w64-libtomcrypt/0001-makefile-enable-no-undefined.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/makefile.shared -+++ b/makefile.shared -@@ -23,7 +23,7 @@ - LIBTOOL:=libtool - endif - endif --ifeq ($(PLATFORM), CYGWIN) -+ifneq ($(findstring $(PLATFORM),CYGWIN MINGW32 MINGW64 MSYS),) - NO_UNDEFINED:=-no-undefined - endif - LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) diff --git a/mingw-w64-libtomcrypt/PKGBUILD b/mingw-w64-libtomcrypt/PKGBUILD index 891e7cab48..723a8a6572 100644 --- a/mingw-w64-libtomcrypt/PKGBUILD +++ b/mingw-w64-libtomcrypt/PKGBUILD @@ -4,7 +4,7 @@ _realname=libtomcrypt pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=1.18.2 -pkgrel=2 +pkgrel=3 pkgdesc="A fairly comprehensive, modular and portable cryptographic toolkit (mingw-w64)." arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32') @@ -13,15 +13,10 @@ license=('custom') depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" "${MINGW_PACKAGE_PREFIX}-gmp" "${MINGW_PACKAGE_PREFIX}-libtommath") -makedepends=("${MINGW_PACKAGE_PREFIX}-cc" - "make") -options=('staticlibs' 'strip') -source=("https://github.com/libtom/libtomcrypt/releases/download/v${pkgver}/crypt-${pkgver}.tar.xz"{,.asc} - "0001-makefile-enable-no-undefined.patch") -sha256sums=('96ad4c3b8336050993c5bc2cf6c057484f2b0f9f763448151567fbab5e767b84' - 'SKIP' - 'c53ab3ef2fa301f09fcfdc8754745b2dff62ed09ea5671e19cc42d778a5e537e') -validpgpkeys=('C4386A237ED43A475541B9427B2CD0DD4BCFF59B') # Steffen Jaeckel +makedepends=("${MINGW_PACKAGE_PREFIX}-cc") +options=('strip') +source=("https://github.com/libtom/libtomcrypt/releases/download/v${pkgver}/crypt-${pkgver}.tar.xz") +sha256sums=('96ad4c3b8336050993c5bc2cf6c057484f2b0f9f763448151567fbab5e767b84') prepare() { cd "${srcdir}/${_realname}-${pkgver}" @@ -29,33 +24,35 @@ prepare() { # Disable unnecessary warnings sed -e "s/ -Wsystem-headers//g" -e "s/ -Wshadow//g" -i makefile_include.mk - # https://github.com/libtom/libtomcrypt/pull/564 - patch -Np1 -i "${srcdir}/0001-makefile-enable-no-undefined.patch" + # Fix linker flag + sed -e "s/--export-all/--export-all-symbols/g" -i makefile.mingw } build() { - cp -rf "${_realname}-${pkgver}" "build-${MINGW_CHOST}" - cd "${srcdir}/build-${MINGW_CHOST}" + cp -rf "${_realname}-${pkgver}" "build-${MSYSTEM}" + cd "${srcdir}/build-${MSYSTEM}" - CPPFLAGS+=" -DLTM_DESC -DGMP_DESC -DUSE_LTM" \ - EXTRALIBS="-ltommath -lgmp" \ - PREFIX="${MINGW_PREFIX}" \ - make -f makefile.shared IGNORE_SPEED=1 all + make -f makefile.mingw all \ + CC=${CC} PREFIX=${MINGW_PREFIX} \ + CFLAGS="-O2 -DLTM_DESC -DGMP_DESC -DUSE_LTM" \ + LTC_LDFLAGS+=" -ltommath -lgmp" } check() { - cd "${srcdir}/build-${MINGW_CHOST}" - #./test + cd ${srcdir}/build-${MSYSTEM} + + ./test.exe } package() { - cd "${srcdir}/build-${MINGW_CHOST}" + cd ${srcdir}/build-${MSYSTEM} - DESTDIR="${pkgdir}" \ - INSTALL_GROUP="root" \ - INSTALL_OPTS="" \ - PREFIX="${MINGW_PREFIX}" \ - make -f makefile.shared install + mkdir -p ${pkgdir}${MINGW_PREFIX}/include + install -Dm755 libtomcrypt.dll "${pkgdir}${MINGW_PREFIX}/bin/libtomcrypt.dll" + install -Dm644 libtomcrypt.a "${pkgdir}${MINGW_PREFIX}/lib/libtomcrypt.a" + install -Dm644 libtomcrypt.dll.a "${pkgdir}${MINGW_PREFIX}/lib/libtomcrypt.dll.a" + install -Dm644 src/headers/tomcrypt*.h "${pkgdir}${MINGW_PREFIX}/include" + install -Dm644 doc/crypt.pdf "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/crypt.pdf" install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE" }