[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debian packaging for spiped



On Sun, Nov 18, 2012 at 01:54:46AM -0800, Colin Percival wrote:
> On 11/17/12 14:12, Peter Pentchev wrote:
> > Wow...  I haven't taken a look at your packaging yet, but it seems that 
> > there has been a bit of a duplication of effort :)  I filed a Debian ITP
> > (intent to package) bug on the same day spiped came out, and I'm almost
> > ready with my package at http://gitorious.org/spiped/spiped :)

Hi Colin, Andreas,

After a quite unfortunate delay of three months, for which I can only
apologize again most sincerely, here's an updated version of my work on
packaging spiped-1.2.2 for Debian - and a couple of attached patches for
Colin's review and possible inclusion upstream.

The whole Debian package is, again, available at
http://gitorious.org/spiped/spiped/commits/debian
git://gitorious.org/spiped/spiped.git -b debian

> Ultimately it's up to you Debian folks, but a few comments:
> 
> 1. I agree with Andreas that setting compiler and linker flags in the
> environment or make command line is better than patching the Makefiles...
> after all, I specifically put bits in to let you do that.

With all due respect, I have to disagree here, but only a bit :)
Of course, if this were only about passing new values to CFLAGS or
LDFLAGS_EXTRA, I would be all for it - and that's what the Debian
package does with CFLAGS.  However, IMHO the upstream build system
should also handle CPPFLAGS and LDFLAGS, not just CFLAGS, for a couple
of reasons:
- even if right now the spiped source doesn't need the distinction
  between C compiler and preprocessor flags, it might very well arise in
  the future; for several of my projects, it arose when I realized that
  I do need some (but not all!) of the definitons at the "make depend"
  stage, when only the preprocessor is invoked.  It makes no real sense
  to pass debugging, optimization, etc flags to the C preprocessor at
  that stage, and some of the environment's settings really do need to
  be passed.  Again, spiped doesn't need this right now, but IMHO it'll
  do no harm.
- in Debian's case, there *are* some settings that the build environment
  passes in CPPFLAGS and not CFLAGS, and they really do need to make it
  into the build system - mostly build hardening flags that are, at the
  present, strongly encouraged if not outright compulsory as defined by
  the Debian Policy document.  Of course, this could've been handled
  very well by adding a simple CFLAGS+= ${CPPFLAGS} in the Debian build
  infrastructure and letting spiped's build system just listen to CFLAGS
  as it already does, but this way - honoring the conventional way of
  passing C preprocessor flags - seems a bit cleaner to me personally.
- finally, a kind of weak argument, but... at least in my software, I've
  (gradually, I have to admit! :) consciously built a habit of following
  the conventions - and over the years I have formed the personal
  opinion that *most* conventions call for CPPFLAGS, CFLAGS and LDFLAGS
  as separate variables with those most common names.  With lots of
  build and packaging systems in all kinds of OSs and distributions, it
  seems easier to me to just honor the flags passed in those variables
  if they are available.

> 2. Similarly, can you add -D_POSIX_C_SOURCE=200809L to CFLAGS instead of
> patching source code?

Yes, I do have to admit that this was a momentary lapse of reason on my
part.  Of *course* it's easier to pass them as flags instead of patching
all the source files that *seem* to need them.  Furthermore, when I did
that and passed them in the global preprocessor flags, it turned out
that I was quite mistaken in shunting out the posix-l.sh invocation
because it had seemed to me at the time that Debian doesn't need librt -
well, with a proper _POSIX_C_SOURCE definition, Debian does want
functions that only exist there :)  So I restored that.

Now...  Once again, it is my personal opinion that the POSIX compliance
flags should be set in the spiped build system, so that it is easier for
people to build it in any POSIX-compliant C environment without the
explicit need of passing more flags.  There is no harm in them being the
default - I hope.  This is the point of my last commit in the repository
- the one that pushes the _POSIX_C_SOURCE definition into the top-level
Makefile in the spiped distribution.  Of course, if you do not like it,
feel free to take the last-but-one commit from the repository and simply
ignore the Makefile bit of the 03-warnings patch attached here.

> 3. I'll add an #ifdef #undef asprintf to my code, so in a future release
> that will no longer be needed.  (I have no plans for future releases at
> this time, but odds are that at some point one will happen.)

Thanks!

> 4. I'm happy with replacing cp/strip/chmod/mv with install -- I would have
> used install myself except that it's not guaranteed to exist on POSIX.

Yep, I completely understand.  I have some ideas about checking for that
at build/install time, but I'll have to think about it some more
(hopefully less than three months this time).

> Finally, can I convince one of you to contribute man pages back under the
> two-clause BSD license so I can include them in a future release?

Many thanks to Andreas for actually taking the time to do that!  I have
included his manual pages in my Debian package, too - after taking the
liberty of once again converting them to yet another representation
format.  In my Debian package, they use the mdoc set of macros instead
of the man ones - IMHO this is 1. a bit more readable, 2. a bit closer
to the BSD origins of spiped itself :)

Once again, thanks to both of you for your work and your patience with
me!

G'luck,
Peter

-- 
Peter Pentchev	roam@ringlet.net roam@FreeBSD.org p.penchev@storpool.com
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
I am the thought you are now thinking.
Description: Honor DESTDIR during installation.
Author: Peter Pentchev <roam@ringlet.net>
Forwarded: not yet
Last-Update: 2012-11-15

--- a/spiped/Makefile
+++ b/spiped/Makefile
@@ -7,11 +7,11 @@
 all:	${PROG}
 
 install:${PROG}
-	mkdir -p ${BINDIR}
-	cp ${PROG} ${BINDIR}/_inst.${PROG}.$$$$_ &&	\
-	    strip ${BINDIR}/_inst.${PROG}.$$$$_ &&	\
-	    chmod 0555 ${BINDIR}/_inst.${PROG}.$$$$_ && \
-	    mv -f ${BINDIR}/_inst.${PROG}.$$$$_ ${BINDIR}/${PROG}
+	mkdir -p ${DESTDIR}${BINDIR}
+	cp ${PROG} ${DESTDIR}${BINDIR}/_inst.${PROG}.$$$$_ &&	\
+	    strip ${DESTDIR}${BINDIR}/_inst.${PROG}.$$$$_ &&	\
+	    chmod 0555 ${DESTDIR}${BINDIR}/_inst.${PROG}.$$$$_ && \
+	    mv -f ${DESTDIR}${BINDIR}/_inst.${PROG}.$$$$_ ${DESTDIR}${BINDIR}/${PROG}
 
 clean:
 	rm -f ${PROG} ${SRCS:.c=.o}
--- a/spipe/Makefile
+++ b/spipe/Makefile
@@ -7,11 +7,11 @@
 all:	${PROG}
 
 install:${PROG}
-	mkdir -p ${BINDIR}
-	cp ${PROG} ${BINDIR}/_inst.${PROG}.$$$$_ &&	\
-	    strip ${BINDIR}/_inst.${PROG}.$$$$_ &&	\
-	    chmod 0555 ${BINDIR}/_inst.${PROG}.$$$$_ && \
-	    mv -f ${BINDIR}/_inst.${PROG}.$$$$_ ${BINDIR}/${PROG}
+	mkdir -p ${DESTDIR}${BINDIR}
+	cp ${PROG} ${DESTDIR}${BINDIR}/_inst.${PROG}.$$$$_ &&	\
+	    strip ${DESTDIR}${BINDIR}/_inst.${PROG}.$$$$_ &&	\
+	    chmod 0555 ${DESTDIR}${BINDIR}/_inst.${PROG}.$$$$_ && \
+	    mv -f ${DESTDIR}${BINDIR}/_inst.${PROG}.$$$$_ ${DESTDIR}${BINDIR}/${PROG}
 
 clean:
 	rm -f ${PROG} ${SRCS:.c=.o}
Description: Honor the compiler and linker flags in the environment.
Author: Peter Pentchev <roam@ringlet.net>
Forwarded: not yet
Last-Update: 2012-11-15

--- a/spipe/Makefile
+++ b/spipe/Makefile
@@ -17,57 +17,57 @@
 	rm -f ${PROG} ${SRCS:.c=.o}
 
 ${PROG}:${SRCS:.c=.o}
-	${CC} -o ${PROG} ${SRCS:.c=.o} ${LDADD_EXTRA} ${LDADD_REQ} ${LDADD_POSIX}
+	${CC} -o ${PROG} ${SRCS:.c=.o} ${LDFLAGS} ${LDADD_EXTRA} ${LDADD_REQ} ${LDADD_POSIX}
 
 main.o: main.c
-	${CC} ${CFLAGS} ${IDIRS} -c main.c -o main.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c main.c -o main.o
 pushbits.o: pushbits.c
-	${CC} ${CFLAGS} ${IDIRS} -c pushbits.c -o pushbits.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c pushbits.c -o pushbits.o
 proto_conn.o: ../proto/proto_conn.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../proto/proto_conn.c -o proto_conn.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../proto/proto_conn.c -o proto_conn.o
 proto_crypt.o: ../proto/proto_crypt.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../proto/proto_crypt.c -o proto_crypt.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../proto/proto_crypt.c -o proto_crypt.o
 proto_handshake.o: ../proto/proto_handshake.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../proto/proto_handshake.c -o proto_handshake.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../proto/proto_handshake.c -o proto_handshake.o
 proto_pipe.o: ../proto/proto_pipe.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../proto/proto_pipe.c -o proto_pipe.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../proto/proto_pipe.c -o proto_pipe.o
 sha256.o: ../lib/alg/sha256.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/alg/sha256.c -o sha256.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/alg/sha256.c -o sha256.o
 elasticarray.o: ../lib/datastruct/elasticarray.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/elasticarray.c -o elasticarray.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/elasticarray.c -o elasticarray.o
 ptrheap.o: ../lib/datastruct/ptrheap.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/ptrheap.c -o ptrheap.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/ptrheap.c -o ptrheap.o
 timerqueue.o: ../lib/datastruct/timerqueue.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/timerqueue.c -o timerqueue.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/timerqueue.c -o timerqueue.o
 asprintf.o: ../lib/util/asprintf.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/asprintf.c -o asprintf.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/asprintf.c -o asprintf.o
 entropy.o: ../lib/util/entropy.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/entropy.c -o entropy.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/entropy.c -o entropy.o
 monoclock.o: ../lib/util/monoclock.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/monoclock.c -o monoclock.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/monoclock.c -o monoclock.o
 sock.o: ../lib/util/sock.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/sock.c -o sock.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/sock.c -o sock.o
 warnp.o: ../lib/util/warnp.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/warnp.c -o warnp.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/warnp.c -o warnp.o
 events_immediate.o: ../lib/events/events_immediate.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/events/events_immediate.c -o events_immediate.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/events/events_immediate.c -o events_immediate.o
 events_network.o: ../lib/events/events_network.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/events/events_network.c -o events_network.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/events/events_network.c -o events_network.o
 events_timer.o: ../lib/events/events_timer.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/events/events_timer.c -o events_timer.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/events/events_timer.c -o events_timer.o
 events.o: ../lib/events/events.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/events/events.c -o events.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/events/events.c -o events.o
 network_buf.o: ../lib/network/network_buf.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/network/network_buf.c -o network_buf.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/network/network_buf.c -o network_buf.o
 network_connect.o: ../lib/network/network_connect.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/network/network_connect.c -o network_connect.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/network/network_connect.c -o network_connect.o
 crypto_aesctr.o: ../lib/crypto/crypto_aesctr.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_aesctr.c -o crypto_aesctr.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_aesctr.c -o crypto_aesctr.o
 crypto_dh.o: ../lib/crypto/crypto_dh.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_dh.c -o crypto_dh.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_dh.c -o crypto_dh.o
 crypto_dh_group14.o: ../lib/crypto/crypto_dh_group14.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_dh_group14.c -o crypto_dh_group14.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_dh_group14.c -o crypto_dh_group14.o
 crypto_entropy.o: ../lib/crypto/crypto_entropy.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_entropy.c -o crypto_entropy.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_entropy.c -o crypto_entropy.o
 crypto_verify_bytes.o: ../lib/crypto/crypto_verify_bytes.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_verify_bytes.c -o crypto_verify_bytes.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_verify_bytes.c -o crypto_verify_bytes.o
--- a/spiped/Makefile
+++ b/spiped/Makefile
@@ -17,61 +17,61 @@
 	rm -f ${PROG} ${SRCS:.c=.o}
 
 ${PROG}:${SRCS:.c=.o}
-	${CC} -o ${PROG} ${SRCS:.c=.o} ${LDADD_EXTRA} ${LDADD_REQ} ${LDADD_POSIX}
+	${CC} -o ${PROG} ${SRCS:.c=.o} ${LDFLAGS} ${LDADD_EXTRA} ${LDADD_REQ} ${LDADD_POSIX}
 
 main.o: main.c
-	${CC} ${CFLAGS} ${IDIRS} -c main.c -o main.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c main.c -o main.o
 dispatch.o: dispatch.c
-	${CC} ${CFLAGS} ${IDIRS} -c dispatch.c -o dispatch.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c dispatch.c -o dispatch.o
 proto_conn.o: ../proto/proto_conn.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../proto/proto_conn.c -o proto_conn.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../proto/proto_conn.c -o proto_conn.o
 proto_crypt.o: ../proto/proto_crypt.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../proto/proto_crypt.c -o proto_crypt.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../proto/proto_crypt.c -o proto_crypt.o
 proto_handshake.o: ../proto/proto_handshake.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../proto/proto_handshake.c -o proto_handshake.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../proto/proto_handshake.c -o proto_handshake.o
 proto_pipe.o: ../proto/proto_pipe.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../proto/proto_pipe.c -o proto_pipe.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../proto/proto_pipe.c -o proto_pipe.o
 sha256.o: ../lib/alg/sha256.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/alg/sha256.c -o sha256.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/alg/sha256.c -o sha256.o
 elasticarray.o: ../lib/datastruct/elasticarray.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/elasticarray.c -o elasticarray.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/elasticarray.c -o elasticarray.o
 ptrheap.o: ../lib/datastruct/ptrheap.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/ptrheap.c -o ptrheap.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/ptrheap.c -o ptrheap.o
 timerqueue.o: ../lib/datastruct/timerqueue.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/timerqueue.c -o timerqueue.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/datastruct/timerqueue.c -o timerqueue.o
 asprintf.o: ../lib/util/asprintf.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/asprintf.c -o asprintf.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/asprintf.c -o asprintf.o
 daemonize.o: ../lib/util/daemonize.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/daemonize.c -o daemonize.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/daemonize.c -o daemonize.o
 entropy.o: ../lib/util/entropy.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/entropy.c -o entropy.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/entropy.c -o entropy.o
 monoclock.o: ../lib/util/monoclock.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/monoclock.c -o monoclock.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/monoclock.c -o monoclock.o
 sock.o: ../lib/util/sock.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/sock.c -o sock.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/sock.c -o sock.o
 warnp.o: ../lib/util/warnp.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/util/warnp.c -o warnp.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/util/warnp.c -o warnp.o
 events_immediate.o: ../lib/events/events_immediate.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/events/events_immediate.c -o events_immediate.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/events/events_immediate.c -o events_immediate.o
 events_network.o: ../lib/events/events_network.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/events/events_network.c -o events_network.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/events/events_network.c -o events_network.o
 events_timer.o: ../lib/events/events_timer.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/events/events_timer.c -o events_timer.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/events/events_timer.c -o events_timer.o
 events.o: ../lib/events/events.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/events/events.c -o events.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/events/events.c -o events.o
 network_accept.o: ../lib/network/network_accept.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/network/network_accept.c -o network_accept.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/network/network_accept.c -o network_accept.o
 network_buf.o: ../lib/network/network_buf.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/network/network_buf.c -o network_buf.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/network/network_buf.c -o network_buf.o
 network_connect.o: ../lib/network/network_connect.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/network/network_connect.c -o network_connect.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/network/network_connect.c -o network_connect.o
 crypto_aesctr.o: ../lib/crypto/crypto_aesctr.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_aesctr.c -o crypto_aesctr.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_aesctr.c -o crypto_aesctr.o
 crypto_dh.o: ../lib/crypto/crypto_dh.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_dh.c -o crypto_dh.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_dh.c -o crypto_dh.o
 crypto_dh_group14.o: ../lib/crypto/crypto_dh_group14.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_dh_group14.c -o crypto_dh_group14.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_dh_group14.c -o crypto_dh_group14.o
 crypto_entropy.o: ../lib/crypto/crypto_entropy.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_entropy.c -o crypto_entropy.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_entropy.c -o crypto_entropy.o
 crypto_verify_bytes.o: ../lib/crypto/crypto_verify_bytes.c
-	${CC} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_verify_bytes.c -o crypto_verify_bytes.o
+	${CC} ${CPPFLAGS} ${CFLAGS} ${IDIRS} -c ../lib/crypto/crypto_verify_bytes.c -o crypto_verify_bytes.o
Description: Fix a couple of compiler warnings.
 - add a _POSIX_C_SOURCE definition to the C preprocessor flags unless
   overridden in the make environment
 - undefine the asprintf macro if it is already defined, e.g. in glibc
Author: Peter Pentchev <roam@ringlet.net>
Forwarded: not yet
Last-Update: 2013-01-25

--- a/lib/util/asprintf.h
+++ b/lib/util/asprintf.h
@@ -2,6 +2,9 @@
 #define _ASPRINTF_H_
 
 /* Avoid namespace collisions with BSD/GNU asprintf. */
+#ifdef asprintf
+#undef asprintf
+#endif
 #define asprintf compat_asprintf
 
 /**
--- a/Makefile
+++ b/Makefile
@@ -2,9 +2,16 @@
 
 PROGS=		spiped spipe
 BINDIR_DEFAULT=	/usr/local/bin
+CPPFLAGS_STD_DEFAULT=	-D_POSIX_C_SOURCE=200809L
 CFLAGS_DEFAULT=	-O2
 
 all:
+	if [ -z "${CPPFLAGS_STD}" ]; then		\
+		CPPFLAGS_STD="${CPPFLAGS_STD_DEFAULT}";	\
+	else						\
+		CPPFLAGS_STD="${CPPFLAGS_STD}";		\
+	fi;						\
+	CPPFLAGS="$${CPPFLAGS} $${CPPFLAGS_STD}";	\
 	if [ -z "${CFLAGS}" ]; then			\
 		CFLAGS=${CFLAGS_DEFAULT};		\
 	else						\
@@ -13,7 +20,7 @@
 	LDADD_POSIX=`export CC=${CC}; cd POSIX && command -p sh posix-l.sh`;	\
 	for D in ${PROGS} ${BENCH}; do		\
 		( cd $${D} && 					\
-		    make CFLAGS="$${CFLAGS}"			\
+		    make CPPFLAGS="$${CPPFLAGS}" CFLAGS="$${CFLAGS}"		\
 			LDADD_POSIX="$${LDADD_POSIX}"		\
 			LDADD_EXTRA="${LDADD_EXTRA}" all ) ||	\
 		    exit 2;					\

Attachment: signature.asc
Description: Digital signature