You are not logged in.

#1 2015-01-16 07:40:25

TheGuy
Member
From: Ohio, USA
Registered: 2015-01-16
Posts: 3

mingw-w64-pdcurses static libraries

Hello!

I noticed during the course of my programming that the mingw-w64-pdcurses package only builds and installs shared versions of the library, not static versions. Since the wiki guidelines (https://wiki.archlinux.org/index.php/Mi … Guidelines) prescribe the compilation of both static and shared versions, I thought I'd fix that.

First, though, I wanted to post my midifications to the PKGBUILD here for review. I'm still fairly new to Arch and its community, and I wanted to be sure I wasn't violating any guidelines. Also, how should I go about submitting these changes to the AUR? Should I just go ahead and upload the new tarball? Should I contact the package maintainer and let him/her upload the new tarball? Or is there a good reason the static libraries weren't built in the first place; in which case, would it be best to upload it as a new mingw-w64-pdcurses-static package?

Here are my proposed modifications:

PKGBUILD

# Contributor: Filip Brcic <brcha@gna.org>
# Contributor: TheGuy <lowelink26381@gmail.com>

pkgname=mingw-w64-pdcurses
pkgver=3.4
pkgrel=3
pkgdesc="Curses library for MinGW (mingw-w64)"
arch=('any')
depends=('mingw-w64-crt')
makedepends=('mingw-w64-gcc')
options=('staticlibs' '!buildflags' '!strip')
license=('custom')
url="http://pdcurses.sourceforge.net/"
source=("http://downloads.sourceforge.net/pdcurses/PDCurses-${pkgver}.tar.gz"
        "mingw-pdcurses-3.4-build.patch")
md5sums=('4e04e4412d1b1392a7f9a489b95b331a'
         '3ab3282497fd815b18a17d4f43eb9fb6')

_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

prepare() {
  cd "${srcdir}/PDCurses-${pkgver}"
  patch -Np1 -i ${srcdir}/mingw-pdcurses-3.4-build.patch
  sed -i "s|CFLAGS  = \-O2 \-Wall|CFLAGS = \-O2 \-g -pipe \-Wall \-Wp,\-D_FORTIFY_SOURCE=2 \-fexceptions \-\-param=ssp\-buffer\-size=4|g" win32/mingwin32.mak
}

build() {
  cd "${srcdir}/PDCurses-${pkgver}"
  export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
  for _arch in ${_architectures}; do
    cp -a win32 build-${_arch} && pushd build-${_arch}
    make -f mingwin32.mak \
      CC=${_arch}-gcc \
      AR=${_arch}-ar \
      LINK=${_arch}-gcc \
      STRIP=${_arch}-strip \
      WIDE=Y UTF8=Y DLL=Y
    make -f mingwin32.mak \
      CC=${_arch}-gcc \
      AR=${_arch}-ar \
      LINK=${_arch}-gcc \
      STRIP=${_arch}-strip \
      WIDE=Y UTF8=Y DLL=N \
      libs
    popd
  done
}

package() {
  cd "${srcdir}/PDCurses-${pkgver}"
  for _arch in ${_architectures} ; do
    install -d "${pkgdir}"/usr/${_arch}/{bin,lib,include}
    install build-${_arch}/pdcurses.dll "${pkgdir}"/usr/${_arch}/bin/
    install build-${_arch}/pdcurses.dll.a "${pkgdir}"/usr/${_arch}/lib/libpdcurses.dll.a
    install build-${_arch}/pdcurses.a "${pkgdir}"/usr/${_arch}/lib/libpdcurses.a
    install -m 0644 curses.h panel.h term.h "${pkgdir}"/usr/${_arch}/include/
    ${_arch}-strip --strip-unneeded "${pkgdir}"/usr/${_arch}/bin/*.dll
    ${_arch}-strip -g "${pkgdir}"/usr/${_arch}/lib/*.a
  done
}

mingw-pdcurses-3.4-build.patch

diff -Naur PDCurses-3.4.orig/win32/mingwin32.mak PDCurses-3.4/win32/mingwin32.mak
--- PDCurses-3.4.orig/win32/mingwin32.mak	2008-07-21 08:31:36.000000000 -0400
+++ PDCurses-3.4/win32/mingwin32.mak	2015-01-15 23:07:24.339995873 -0500
@@ -19,6 +19,8 @@
 PDCURSES_WIN_H	= $(osdir)/pdcwin.h
 
 CC		= gcc
+AR		= ar
+STRIP		= strip
 
 ifeq ($(DEBUG),Y)
 	CFLAGS  = -g -Wall -DPDCDEBUG
@@ -30,8 +32,8 @@
 
 CFLAGS += -I$(PDCURSES_SRCDIR)
 
-BASEDEF		= $(PDCURSES_SRCDIR)\exp-base.def
-WIDEDEF		= $(PDCURSES_SRCDIR)\exp-wide.def
+BASEDEF		= $(PDCURSES_SRCDIR)/exp-base.def
+WIDEDEF		= $(PDCURSES_SRCDIR)/exp-wide.def
 
 DEFDEPS		= $(BASEDEF)
 
@@ -50,14 +52,14 @@
 
 ifeq ($(DLL),Y)
 	CFLAGS += -DPDC_DLL_BUILD
-	LIBEXE = gcc $(DEFFILE)
-	LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o
+	LIBEXE = $(CC) $(DEFFILE)
+	LIBFLAGS = -Wl,--out-implib,pdcurses.dll.a -shared -o
 	LIBCURSES = pdcurses.dll
 	LIBDEPS = $(LIBOBJS) $(PDCOBJS) $(DEFFILE)
 	CLEAN = $(LIBCURSES) *.a $(DEFFILE)
 else
-	LIBEXE = ar
-	LIBFLAGS = rcv
+	LIBEXE = $(AR)
+	LIBFLAGS = rcvs
 	LIBCURSES = pdcurses.a
 	LIBDEPS = $(LIBOBJS) $(PDCOBJS)
 	CLEAN = *.a
@@ -70,24 +72,24 @@
 libs:	$(LIBCURSES)
 
 clean:
-	-del *.o
-	-del *.exe
-	-del $(CLEAN)
+	-rm *.o
+	-rm *.exe
+	-rm $(CLEAN)
 
 demos:	$(DEMOS)
-	strip *.exe
+	$(STRIP) *.exe
 
 $(DEFFILE): $(DEFDEPS)
 	echo LIBRARY pdcurses > $@
 	echo EXPORTS >> $@
-	type $(BASEDEF) >> $@
+	cat $(BASEDEF) >> $@
 ifeq ($(WIDE),Y)
-	type $(WIDEDEF) >> $@
+	cat $(WIDEDEF) >> $@
 endif
 
 $(LIBCURSES) : $(LIBDEPS)
 	$(LIBEXE) $(LIBFLAGS) $@ $?
-	-copy pdcurses.a panel.a
+	-cp pdcurses.dll.a panel.a
 
 $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
 $(PDCOBJS) : $(PDCURSES_WIN_H)

Offline

#2 2015-01-16 07:59:38

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: mingw-w64-pdcurses static libraries

Arch doesn't package static libs unless there's no shared version or there's a compelling reason the static libs should be included. You're best off making a new package unless you can come up with a good argument for them.

Last edited by Scimmia (2015-01-16 08:03:04)

Offline

#3 2015-01-16 08:48:58

TheGuy
Member
From: Ohio, USA
Registered: 2015-01-16
Posts: 3

Re: mingw-w64-pdcurses static libraries

As noted in the wiki page I linked earlier, the mingw-w64 packages are treated uniquely in that they should "always build both shared and static binaries, unless they conflict". Indeed, this convention is followed in similar packages, like mingw-w64-readline, which depends on mingw-w64-pdcurses. Surely this package should also endeavour to supply static libs, so that software linking against static libs provided by its dependencies can be (fully) statically cross-compiled?

Last edited by TheGuy (2015-01-16 08:52:36)

Offline

#4 2015-01-16 15:16:34

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: mingw-w64-pdcurses static libraries

The wiki is community maintained. Some random person added that in 2012, it doesn't make it law.

Offline

#5 2015-01-16 17:49:28

TheGuy
Member
From: Ohio, USA
Registered: 2015-01-16
Posts: 3

Re: mingw-w64-pdcurses static libraries

That's true. I'll try to contact the package maintainer and see how he/she thinks the package should behave. If the expectations for mingw-w64 packages have changed, I'll update the wiki myself.

Offline

Board footer

Powered by FluxBB