switch to autotools-based build and follow the upstream install layout

This commit is contained in:
naddy 2013-06-03 02:46:25 +00:00
parent ce78c75c2a
commit a6602dfa4e
7 changed files with 49 additions and 154 deletions

View File

@ -1,11 +1,13 @@
# $OpenBSD: Makefile,v 1.91 2013/04/15 02:38:43 brad Exp $
# $OpenBSD: Makefile,v 1.92 2013/06/03 02:46:25 naddy Exp $
COMMENT= library for manipulating PNG images
VERSION= 1.5.15
REVISION= 1
DISTNAME= libpng-${VERSION}
PKGNAME= png-${VERSION}
SHARED_LIBS= png 15.1
SHARED_LIBS= png15 16.0 \
png 16.0
CATEGORIES= graphics
DPB_PROPERTIES= parallel
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=libpng/}
@ -17,17 +19,12 @@ PERMIT_PACKAGE_CDROM= Yes
WANTLIB= m z
SUBST_VARS= VERSION
SEPARATE_BUILD= Yes
CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= ${CONFIGURE_SHARED}
FAKE_FLAGS= PREFIX="${PREFIX}"
MAKE_ENV= CC="${CC}"
MAKE_FILE= scripts/makefile.openbsd
MAKE_FLAGS= SHLIB_MAJOR=${LIBpng_VERSION:R} \
SHLIB_MINOR=${LIBpng_VERSION:E} \
PNGLIB_VERSION=${VERSION}
do-configure:
cp ${WRKSRC}/scripts/pnglibconf.h.prebuilt ${WRKBUILD}/pnglibconf.h
post-install:
cd ${PREFIX}/lib; \
ln -s libpng15.so.${LIBpng15_VERSION} libpng.so.${LIBpng_VERSION}
.include <bsd.port.mk>

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-libpng-config_in,v 1.1 2013/06/03 02:46:25 naddy Exp $
--- libpng-config.in.orig Wed Mar 27 21:21:26 2013
+++ libpng-config.in Sat Jun 1 22:22:21 2013
@@ -16,8 +16,8 @@ prefix="@prefix@"
exec_prefix="@exec_prefix@"
libdir="@libdir@"
includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@"
-libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@"
-all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @LIBS@"
+libs="-lpng"
+all_libs="-lpng @LIBS@"
I_opts="-I${includedir}"
L_opts="-L${libdir}"
R_opts=""

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-libpng_pc_in,v 1.1 2013/06/03 02:46:25 naddy Exp $
--- libpng.pc.in.orig Wed Mar 27 21:21:26 2013
+++ libpng.pc.in Sat Jun 1 18:29:52 2013
@@ -6,6 +6,6 @@ includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MI
Name: libpng
Description: Loads and saves PNG files
Version: @PNGLIB_VERSION@
-Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
+Libs: -L${libdir} -lpng
Libs.private: @LIBS@
Cflags: -I${includedir}

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-scripts_libpng-config-body_in,v 1.1 2013/03/25 00:21:37 brad Exp $
--- scripts/libpng-config-body.in.orig Sat Mar 23 20:59:22 2013
+++ scripts/libpng-config-body.in Sat Mar 23 21:00:37 2013
@@ -83,6 +83,7 @@ while test $# -gt 0; do
--static)
R_opts=""
+ libs="${libs} ${static_libs}"
;;
*)

View File

@ -1,17 +0,0 @@
$OpenBSD: patch-scripts_libpng_pc_in,v 1.26 2013/04/15 02:38:43 brad Exp $
--- scripts/libpng.pc.in.orig Wed Mar 27 21:21:27 2013
+++ scripts/libpng.pc.in Thu Apr 11 21:30:19 2013
@@ -1,10 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
-includedir=@includedir@/libpng15
+includedir=@includedir@
Name: libpng
Description: Loads and saves PNG files
Version: 1.5.15
-Libs: -L${libdir} -lpng15
+Libs: -L${libdir} -lpng
+Libs.private: -lz -lm
Cflags: -I${includedir}

View File

@ -1,108 +0,0 @@
$OpenBSD: patch-scripts_makefile_openbsd,v 1.40 2013/04/15 02:38:43 brad Exp $
--- scripts/makefile.openbsd.orig Wed Mar 27 21:21:27 2013
+++ scripts/makefile.openbsd Thu Apr 11 21:29:02 2013
@@ -7,8 +7,10 @@
# 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.15
@@ -22,15 +24,34 @@ HDRS= png.h pngconf.h pnglibconf.h
CFLAGS+= -W -Wall
CPPFLAGS+= -I${.CURDIR}
+LDADD= -lz -lm
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 libs=\"-lpng\"; \
+ echo static_libs=\"-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 +62,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: contrib/libtests/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 +89,18 @@ 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>

View File

@ -1,13 +1,22 @@
@comment $OpenBSD: PLIST,v 1.26 2013/03/25 00:21:37 brad Exp $
@comment $OpenBSD: PLIST,v 1.27 2013/06/03 02:46:25 naddy Exp $
bin/libpng-config
include/libpng/
include/libpng/png.h
include/libpng/pngconf.h
include/libpng/pnglibconf.h
bin/libpng15-config
include/libpng15/
include/libpng15/png.h
include/libpng15/pngconf.h
include/libpng15/pnglibconf.h
include/png.h
include/pngconf.h
include/pnglibconf.h
lib/libpng.a
lib/libpng.la
@lib lib/libpng.so.${LIBpng_VERSION}
lib/libpng15.a
lib/libpng15.la
@lib lib/libpng15.so.${LIBpng15_VERSION}
lib/pkgconfig/
lib/pkgconfig/libpng.pc
lib/pkgconfig/libpng15.pc
@man man/man3/libpng.3
@man man/man3/libpngpf.3
@man man/man5/png.5