openbsd-ports/graphics/png/patches/patch-scripts_makefile_openbsd
sthen 378c061449 SECURITY update to png 1.5.5, fixing a divide-by-zero with malformed cHRM
chunks, this bug was introduced in 1.5.4 - CVE-2011-3328. Clues from naddy@
2011-09-23 21:00:28 +00:00

109 lines
3.8 KiB
Plaintext

$OpenBSD: patch-scripts_makefile_openbsd,v 1.35 2011/09/23 21:00:28 sthen Exp $
--- scripts/makefile.openbsd.orig Thu Sep 22 14:40:25 2011
+++ scripts/makefile.openbsd Fri Sep 23 09:20:15 2011
@@ -7,12 +7,11 @@
# and license in png.h
PREFIX?= /usr/local
+BINDIR= ${PREFIX}/bin
LIBDIR= ${PREFIX}/lib
-MANDIR= ${PREFIX}/man/cat
+MANDIR= ${PREFIX}/man/man
+INCDIR= ${PREFIX}/include/libpng
-SHLIB_MAJOR= 15
-SHLIB_MINOR= 1.5.5
-
LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
pngread.c pngrio.c pngrtran.c pngrutil.c pngset.c pngtrans.c \
@@ -25,12 +24,30 @@ CPPFLAGS+= -I${.CURDIR}
NOPROFILE= Yes
-CLEANFILES+= pngtest.o pngtest pnglibconf.h
+CLEANFILES+= pngtest.o pngtest pngvalid.o pngvalid pnglibconf.h libpng-config
MAN= libpng.3 libpngpf.3 png.5
-DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
- libpng-manual.txt
+all: pnglibconf.h ${_LIBS} libpng-config libpng.pc
+
+beforedepend: pnglibconf.h
+
+libpng.pc:
+ sed < scripts/libpng.pc.in -e s'!@prefix@!$(PREFIX)!' \
+ -e 's!@exec_prefix@!$(BINDIR)!' -e 's!@libdir@!$(LIBDIR)!' \
+ -e 's!@includedir@!$(INCDIR)!' \
+ -e 's!@PNGLIB_VERSION@!$(PNGLIB_VERSION)!' > libpng.pc
+
+libpng-config:
+ ( cat scripts/libpng-config-head.in; \
+ echo prefix=\"$(PREFIX)\"; \
+ echo I_opts=\"-I$(INCDIR)\"; \
+ echo L_opts=\"-L$(LIBDIR)\"; \
+ echo R_opts=\"-Wl,-rpath,$(LIBDIR)\"; \
+ echo libs=\"-lpng -lz -lm\"; \
+ cat scripts/libpng-config-body.in ) > libpng-config
+ chmod +x libpng-config
+
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
@@ -41,13 +58,20 @@ pngtest.o: pngtest.c
pngtest: pngtest.o
${CC} ${LDFLAGS} ${.ALLSRC} -o ${.TARGET} -L${.OBJDIR} -lpng -lz -lm
-test: pngtest
- cd ${.OBJDIR} && env \
- LD_LIBRARY_PATH="${.OBJDIR}" ${.OBJDIR}/pngtest
+pngvalid.o: pngvalid.c
+ ${CC} ${CPPFLAGS} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET}
+pngvalid: pngvalid.o
+ ${CC} ${LDFLAGS} ${.ALLSRC} -o ${.TARGET} -L${.OBJDIR} -lpng -lz -lm
+
+test regress: pngtest pngvalid
+ @LD_LIBRARY_PATH="${.OBJDIR}" srcdir=. ./test-pngtest.sh
+ @LD_LIBRARY_PATH="${.OBJDIR}" ./test-pngvalid-simple.sh
+ @LD_LIBRARY_PATH="${.OBJDIR}" ./test-pngvalid-full.sh
+
beforeinstall:
- if [ ! -d ${DESTDIR}${PREFIX}/include/libpng ]; then \
- ${INSTALL} -d -o root -g wheel ${DESTDIR}${PREFIX}/include; \
+ if [ ! -d ${DESTDIR}${INCDIR} ]; then \
+ ${INSTALL} -d -o root -g wheel ${DESTDIR}${INCDIR}; \
fi
if [ ! -d ${DESTDIR}${LIBDIR} ]; then \
${INSTALL} -d -o root -g wheel ${DESTDIR}${LIBDIR}; \
@@ -61,22 +85,19 @@ beforeinstall:
if [ ! -d ${DESTDIR}${MANDIR}5 ]; then \
${INSTALL} -d -o root -g wheel ${DESTDIR}${MANDIR}5; \
fi
- if [ ! -d ${DESTDIR}${PREFIX}/share/doc/png ]; then \
- ${INSTALL} -d -o root -g wheel ${DESTDIR}${PREFIX}/share/doc/png; \
+ if [ ! -d ${DESTDIR}${LIBDIR}/pkgconfig ]; then \
+ ${INSTALL} -d -o root -g wheel ${DESTDIR}${LIBDIR}/pkgconfig; \
fi
afterinstall:
@rm -f ${DESTDIR}${LIBDIR}/libpng_pic.a
@rm -f ${DESTDIR}${LIBDIR}/debug/libpng.a
- @rm -f ${DESTDIR}${PREFIX}/include/png.h
- @rm -f ${DESTDIR}${PREFIX}/include/pngconf.h
- @rm -f ${DESTDIR}${PREFIX}/include/pnglibconf.h
@rmdir ${DESTDIR}${LIBDIR}/debug 2>/dev/null || true
+ ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \
+ -m ${BINMODE} libpng-config ${DESTDIR}${BINDIR}
${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
- -m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include
+ -m ${NONBINMODE} ${HDRS} ${DESTDIR}${INCDIR}
${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
- -m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include
- ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
- -m ${NONBINMODE} ${DOCS} ${DESTDIR}${PREFIX}/share/doc/png
+ -m ${NONBINMODE} libpng.pc ${DESTDIR}${LIBDIR}/pkgconfig
.include <bsd.lib.mk>