From e81f3590699441d9a2f74dd1918b7d442e857109 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sat, 11 Dec 2021 13:43:16 +0100 Subject: [PATCH 1/2] ncurses: import fix from Arch to not leak LDFLAGS into pkg-config --- mingw-w64-ncurses/PKGBUILD | 12 +++++++--- mingw-w64-ncurses/ncurses-6.3-pkgconfig.patch | 24 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 mingw-w64-ncurses/ncurses-6.3-pkgconfig.patch diff --git a/mingw-w64-ncurses/PKGBUILD b/mingw-w64-ncurses/PKGBUILD index fd90c86f2c..631574ab6a 100644 --- a/mingw-w64-ncurses/PKGBUILD +++ b/mingw-w64-ncurses/PKGBUILD @@ -7,7 +7,7 @@ pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" #_date_rev=20211108 #kgver=${_base_ver}.${_date_rev} pkgver=6.3 -pkgrel=1 +pkgrel=2 pkgdesc="System V Release 4.0 curses emulation library (mingw-w64)" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64') @@ -19,17 +19,23 @@ options=('staticlibs' 'strip') source=(#"${_realname}-${pkgver}.tar.gz"::"https://invisible-mirror.net/archives/ncurses/current/${_realname}-${_base_ver}.tgz" https://ftp.gnu.org/pub/gnu/ncurses/ncurses-${pkgver}.tar.gz{,.sig} 001-use-libsystre.patch - 002-ncurses-config-win-paths.patch) + 002-ncurses-config-win-paths.patch + ncurses-6.3-pkgconfig.patch) sha256sums=('97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059' 'SKIP' 'd8fb37262372f3e5c9a553bdeff07c8b874bac6f3c416e2a372877cef0af1925' - '5367d8f49aff92884b9daa014502df13e1812f1b7ee1b3a3cb18139f10039408') + '5367d8f49aff92884b9daa014502df13e1812f1b7ee1b3a3cb18139f10039408' + 'b8544a607dfbeffaba2b087f03b57ed1fa81286afca25df65f61b04b5f3b3738') validpgpkeys=('19882D92DDA4C400C22C0D56CC2AF4472167BE03') prepare() { cd ${_realname}-${pkgver} patch -p1 -i ${srcdir}/001-use-libsystre.patch patch -p1 -i ${srcdir}/002-ncurses-config-win-paths.patch + + # do not leak build-time LDFLAGS into the pkgconfig files: + # https://bugs.archlinux.org/task/68523 + patch -p1 -i ${srcdir}/ncurses-6.3-pkgconfig.patch } build() { diff --git a/mingw-w64-ncurses/ncurses-6.3-pkgconfig.patch b/mingw-w64-ncurses/ncurses-6.3-pkgconfig.patch new file mode 100644 index 0000000000..e3b5d4650d --- /dev/null +++ b/mingw-w64-ncurses/ncurses-6.3-pkgconfig.patch @@ -0,0 +1,24 @@ +diff -ruN a/misc/gen-pkgconfig.in b/misc/gen-pkgconfig.in +--- a/misc/gen-pkgconfig.in 2021-08-07 23:36:33.000000000 +0200 ++++ b/misc/gen-pkgconfig.in 2021-11-03 11:12:51.127160950 +0100 +@@ -83,7 +83,7 @@ + fi + + lib_flags= +-for opt in -L$libdir @EXTRA_PKG_LDFLAGS@ @LIBS@ ++for opt in -L$libdir @LIBS@ + do + case $opt in + -l*) # LIBS is handled specially below +diff -ruN a/misc/ncurses-config.in b/misc/ncurses-config.in +--- a/misc/ncurses-config.in 2021-08-07 23:36:14.000000000 +0200 ++++ b/misc/ncurses-config.in 2021-11-03 11:26:12.393533954 +0100 +@@ -101,7 +101,7 @@ + # There is no portable way to find the list of standard library directories. + # Require a POSIX shell anyway, to keep this simple. + lib_flags= +-for opt in -L$libdir @EXTRA_PKG_LDFLAGS@ $LIBS ++for opt in -L$libdir $LIBS + do + case $opt in + -specs*) # ignore linker specs-files which were used to build library From 30c2fdfd4472574e55e80e50690ca23ebc5c421b Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sat, 11 Dec 2021 13:56:44 +0100 Subject: [PATCH 2/2] ncurses: define NCURSES_STATIC by default again this was removed in https://github.com/mirror/ncurses/commit/04d942c3d98cf0a929c6afb17be8c10d4ae39af0 We only provide static builds right now and the .pc file doesn't include a Cflags.static so no users know that this needs to be set or that only static builds are available. So revert this for now. In the future we could look into adding shared builds and define a Cflags.private for static builds. Then this patch could be removed again. Fixes #10312 --- .../003-restore-static-builds-without-macro.patch | 14 ++++++++++++++ mingw-w64-ncurses/PKGBUILD | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-ncurses/003-restore-static-builds-without-macro.patch diff --git a/mingw-w64-ncurses/003-restore-static-builds-without-macro.patch b/mingw-w64-ncurses/003-restore-static-builds-without-macro.patch new file mode 100644 index 0000000000..13028941cc --- /dev/null +++ b/mingw-w64-ncurses/003-restore-static-builds-without-macro.patch @@ -0,0 +1,14 @@ +--- ncurses-6.3/include/ncurses_dll.h.in.orig 2021-12-11 13:47:24.101612300 +0100 ++++ ncurses-6.3/include/ncurses_dll.h.in 2021-12-11 13:47:24.572486300 +0100 +@@ -78,6 +78,11 @@ + #define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API + #define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type + ++/* XXX: MSYS2 hack to keep static builds working by default ++ * https://github.com/msys2/MINGW-packages/issues/10312 ++ */ ++#define NCURSES_STATIC ++ + /* + * These symbols hide dllimport/dllexport, for compilers which care about it. + */ diff --git a/mingw-w64-ncurses/PKGBUILD b/mingw-w64-ncurses/PKGBUILD index 631574ab6a..b8df4fdc8e 100644 --- a/mingw-w64-ncurses/PKGBUILD +++ b/mingw-w64-ncurses/PKGBUILD @@ -7,7 +7,7 @@ pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" #_date_rev=20211108 #kgver=${_base_ver}.${_date_rev} pkgver=6.3 -pkgrel=2 +pkgrel=3 pkgdesc="System V Release 4.0 curses emulation library (mingw-w64)" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64') @@ -20,11 +20,13 @@ source=(#"${_realname}-${pkgver}.tar.gz"::"https://invisible-mirror.net/archives https://ftp.gnu.org/pub/gnu/ncurses/ncurses-${pkgver}.tar.gz{,.sig} 001-use-libsystre.patch 002-ncurses-config-win-paths.patch + 003-restore-static-builds-without-macro.patch ncurses-6.3-pkgconfig.patch) sha256sums=('97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059' 'SKIP' 'd8fb37262372f3e5c9a553bdeff07c8b874bac6f3c416e2a372877cef0af1925' '5367d8f49aff92884b9daa014502df13e1812f1b7ee1b3a3cb18139f10039408' + '31854494f5a27cbe8d1f2c044c0857a86ae1bc847b916d02120b94517b3bb653' 'b8544a607dfbeffaba2b087f03b57ed1fa81286afca25df65f61b04b5f3b3738') validpgpkeys=('19882D92DDA4C400C22C0D56CC2AF4472167BE03') @@ -33,6 +35,9 @@ prepare() { patch -p1 -i ${srcdir}/001-use-libsystre.patch patch -p1 -i ${srcdir}/002-ncurses-config-win-paths.patch + # https://github.com/msys2/MINGW-packages/issues/10312 + patch -p1 -i ${srcdir}/003-restore-static-builds-without-macro.patch + # do not leak build-time LDFLAGS into the pkgconfig files: # https://bugs.archlinux.org/task/68523 patch -p1 -i ${srcdir}/ncurses-6.3-pkgconfig.patch