psutils: fix PIE

See #4572
This commit is contained in:
Juergen Buchmueller 2016-09-06 14:26:23 +02:00
parent 2ef6b95eed
commit 97f375107e
2 changed files with 54 additions and 21 deletions

View file

@ -40,7 +40,7 @@ diff -rupN psutils/Makefile.unix psutils-new/Makefile.unix
BINMODE = 0755 BINMODE = 0755
MANMODE = 0644 MANMODE = 0644
@@ -36,23 +47,30 @@ CHMOD = chmod @@ -36,61 +47,79 @@
INSTALL = install -c -m $(BINMODE) INSTALL = install -c -m $(BINMODE)
INSTALLMAN = install -c -m $(MANMODE) INSTALLMAN = install -c -m $(MANMODE)
MANEXT = 1 MANEXT = 1
@ -49,19 +49,21 @@ diff -rupN psutils/Makefile.unix psutils-new/Makefile.unix
CC = gcc CC = gcc
-CFLAGS = -DPAPER=\"$(PAPER)\" -DUNIX -O -Wall -CFLAGS = -DPAPER=\"$(PAPER)\" -DUNIX -O -Wall
+CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+ifdef LIBPAPER
+ CFLAGS += -DDEBIAN -DUNIX -O2 -g -Wall -Werror
+ LIBS = -lpaper
+else
+ CFLAGS += -DPAPER=\"$(PAPER)\" -DUNIX -O2 -g -Wall -Werror
+ LIBS =
+endif
-BIN = psbook psselect pstops epsffit psnup \ -BIN = psbook psselect pstops epsffit psnup \
- psresize - psresize
-SHELLSCRIPTS = getafm showchar -SHELLSCRIPTS = getafm showchar
-PERLSCRIPTS = fixfmps fixmacps fixpsditps fixpspps \ -PERLSCRIPTS = fixfmps fixmacps fixpsditps fixpspps \
+ifdef LIBPAPER
+ CFLAGS = -DDEBIAN -DUNIX -O2 -g -Wall -Werror
+ LIBS = -lpaper
+else
+ CFLAGS = -DPAPER=\"$(PAPER)\" -DUNIX -O2 -g -Wall -Werror
+ LIBS =
+endif
+
+ +
+BIN = psbook psselect pstops epsffit psnup psresize +BIN = psbook psselect pstops epsffit psnup psresize
+SHELLSCRIPTS = getafm showchar psjoin +SHELLSCRIPTS = getafm showchar psjoin
@ -81,32 +83,60 @@ diff -rupN psutils/Makefile.unix psutils-new/Makefile.unix
all: $(BIN) $(PERLSCRIPTS) $(MANPAGES) $(SHELLSCRIPTS) all: $(BIN) $(PERLSCRIPTS) $(MANPAGES) $(SHELLSCRIPTS)
@@ -68,12 +86,13 @@ epsffit: epsffit.o pserror.o psutil.o: psutil.h patchlev.h pserror.h psutil.c
$(CC) $(CCFLAGS) -o epsffit pserror.o epsffit.o + $(CC) $(CFLAGS) -o $@ -c psutil.c
psspec.o: psutil.h patchlev.h psspec.h pserror.h psspec.c
+ $(CC) $(CFLAGS) -o $@ -c psspec.c
pserror.o: psutil.h patchlev.h pserror.h pserror.c
+ $(CC) $(CFLAGS) -o $@ -c pserror.c
epsffit.o: epsffit.c pserror.h patchlev.h
+ $(CC) $(CFLAGS) -o $@ -c epsffit.c
epsffit: epsffit.o pserror.o
- $(CC) $(CCFLAGS) -o epsffit pserror.o epsffit.o
+ $(CC) $(LDFLAGS) -o epsffit pserror.o epsffit.o
psnup: psnup.o psutil.o psspec.o pserror.o psnup: psnup.o psutil.o psspec.o pserror.o
- $(CC) $(CCFLAGS) -o psnup psutil.o psspec.o pserror.o psnup.o - $(CC) $(CCFLAGS) -o psnup psutil.o psspec.o pserror.o psnup.o
+ $(CC) $(CCFLAGS) -o psnup psutil.o psspec.o pserror.o psnup.o $(LIBS) + $(CC) $(LDFLAGS) -o psnup psutil.o psspec.o pserror.o psnup.o $(LIBS)
psnup.o: psutil.h patchlev.h psspec.h pserror.h psnup.c psnup.o: psutil.h patchlev.h psspec.h pserror.h psnup.c
+ $(CC) $(CFLAGS) -o $@ -c psnup.c
psresize: psresize.o psutil.o pserror.o psspec.o psresize: psresize.o psutil.o pserror.o psspec.o
- $(CC) $(CCFLAGS) -o psresize psutil.o psspec.o pserror.o psresize.o - $(CC) $(CCFLAGS) -o psresize psutil.o psspec.o pserror.o psresize.o
+ $(CC) $(CCFLAGS) -o psresize psutil.o psspec.o pserror.o psresize.o \ + $(CC) $(LDFLAGS) -o psresize psutil.o psspec.o pserror.o psresize.o \
+ $(LIBS) + $(LIBS)
psresize.o: psutil.h patchlev.h psspec.h pserror.h psresize.c psresize.o: psutil.h patchlev.h psspec.h pserror.h psresize.c
+ $(CC) $(CFLAGS) -o $@ -c psresize.c
psbook: psbook.o psutil.o pserror.o
- $(CC) $(CCFLAGS) -o psbook psutil.o pserror.o psbook.o
+ $(CC) $(LDFLAGS) -o psbook psutil.o pserror.o psbook.o
psbook.o: psutil.h patchlev.h pserror.h psbook.c
+ $(CC) $(CFLAGS) -o $@ -c psbook.c
psselect: psselect.o psutil.o pserror.o
- $(CC) $(CCFLAGS) -o psselect psutil.o pserror.o psselect.o
+ $(CC) $(LDFLAGS) -o psselect psutil.o pserror.o psselect.o
@@ -88,7 +107,7 @@ psselect: psselect.o psutil.o pserror.o
psselect.o: psutil.h patchlev.h pserror.h psselect.c psselect.o: psutil.h patchlev.h pserror.h psselect.c
pstops: pstops.o psutil.o psspec.o pserror.o pstops: pstops.o psutil.o psspec.o pserror.o
- $(CC) $(CCFLAGS) -o pstops psutil.o psspec.o pserror.o pstops.o - $(CC) $(CCFLAGS) -o pstops psutil.o psspec.o pserror.o pstops.o
+ $(CC) $(CCFLAGS) -o pstops psutil.o psspec.o pserror.o pstops.o $(LIBS) + $(CC) $(LDFLAGS) -o pstops psutil.o psspec.o pserror.o pstops.o $(LIBS)
pstops.o: psutil.h patchlev.h psspec.h pserror.h pstops.c pstops.o: psutil.h patchlev.h psspec.h pserror.h pstops.c
+ $(CC) $(CFLAGS) -o $@ -c pstops.c
@@ -106,10 +125,6 @@ fixfmps: fixfmps.pl getafm: getafm.sh
cp $? $@
@@ -106,10 +135,6 @@
$(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@
$(CHMOD) $(BINMODE) $@ $(CHMOD) $(BINMODE) $@
@ -117,7 +147,7 @@ diff -rupN psutils/Makefile.unix psutils-new/Makefile.unix
fixpsditps: fixpsditps.pl fixpsditps: fixpsditps.pl
$(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@
$(CHMOD) $(BINMODE) $@ $(CHMOD) $(BINMODE) $@
@@ -171,11 +186,11 @@ pstops.$(MANEXT): pstops.man @@ -171,11 +196,11 @@
psmerge.$(MANEXT): psmerge.man psmerge.$(MANEXT): psmerge.man
$(PERL) maketext "MAN=$(MANPAGES)" $? > $@ $(PERL) maketext "MAN=$(MANPAGES)" $? > $@
@ -132,7 +162,7 @@ diff -rupN psutils/Makefile.unix psutils-new/Makefile.unix
fixpsditps.$(MANEXT): fixpsditps.man fixpsditps.$(MANEXT): fixpsditps.man
$(PERL) maketext "MAN=$(MANPAGES)" $? > $@ $(PERL) maketext "MAN=$(MANPAGES)" $? > $@
@@ -210,39 +225,35 @@ includeres.$(MANEXT): includeres.man @@ -210,39 +235,35 @@
getafm.$(MANEXT): getafm.man getafm.$(MANEXT): getafm.man
$(PERL) maketext "MAN=$(MANPAGES)" $? > $@ $(PERL) maketext "MAN=$(MANPAGES)" $? > $@

View file

@ -1,7 +1,7 @@
# Template file for 'psutils' # Template file for 'psutils'
pkgname="psutils" pkgname="psutils"
version="p17" version="p17"
revision=3 revision=4
short_desc="Set of utilities to manipulate PostScript files" short_desc="Set of utilities to manipulate PostScript files"
maintainer="Carlo Dormeletti <carloDOTdormelettiATaliceDOTit>" maintainer="Carlo Dormeletti <carloDOTdormelettiATaliceDOTit>"
license="AJCD-License" license="AJCD-License"
@ -16,10 +16,13 @@ patch_args="-Np1"
pre_configure() { pre_configure() {
# install in /usr instead of /usr/local # install in /usr instead of /usr/local
sed 's@/usr/local@/usr@g' Makefile.unix > Makefile sed -e "s;/usr/local;/usr;g" \
-e "s;@CFLAGS@;$CFLAGS;" \
-e "s;@LDFLAGS@;$LDFLAGS;" \
Makefile.unix > Makefile
} }
do_build() { do_build() {
make CC=$CC CFLAGS="$CFLAGS" make CC=$CC ${makejobs}
} }
do_install() { do_install() {
make DESTDIR=${DESTDIR} install make DESTDIR=${DESTDIR} install