Added support for building packages that use GNU or BSD Makefiles

and extraction of zip distfiles via a new helper:
unzip-extraction.sh.

When a new template uses extract_sufx=".zip" and the unzip command
is not found on PKGFS_MASTERDIR/bin/unzip, the unzip package will
be installed automatically.

Also add jasper-1.900.1 template that uses a zip distfile.

--HG--
extra : convert_revision : a979bdd3aef82d64e490606c21aa8f557d76fdbd
This commit is contained in:
Juan RP 2008-10-03 00:44:43 +02:00
parent 39d7aee194
commit b1c2d7613a
6 changed files with 121 additions and 8 deletions

BIN
dependencies/jasper-1.900.1-deps.db vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,19 @@
# Helper for templates using extract_sufx=".zip" that installs the unzip
# package if it's not available in PKGFS_MASTERDIR.
unzip_version="5.52"
# If unzip is already installed just return immediately.
check_installed_tmpl unzip-$unzip_version
if [ "$?" -ne 0 ]; then
echo "=> unzip not installed, will install it."
install_tmpl unzip-$unzip_version
#
# Continue with origin template that called us.
#
reset_tmpl_vars
run_file ${origin_tmpl}
fi
unset unzip_version
unzip_cmd=$PKGFS_MASTERDIR/bin/unzip

View file

@ -31,7 +31,6 @@
# TODO
# - Multiple distfiles in a package.
# - Multiple URLs to download source distribution files.
# - Support GNU/BSD-makefile style source distribution files.
# - Fix PKGFS_{C,CXX}FLAGS, aren't passed to the environment yet.
# - Support adding filters to templates to avoid creating useless links.
#
@ -48,7 +47,6 @@
: ${awk_cmd:=/usr/bin/awk}
: ${mkdir_cmd:=/bin/mkdir -p}
: ${tar_cmd:=/usr/bin/tar}
: ${unzip_cmd:=/usr/pkg/bin/unzip}
: ${rm_cmd:=/bin/rm}
: ${mv_cmd:=/bin/mv}
: ${cp_cmd:=/bin/cp}
@ -331,7 +329,11 @@ check_tmpl_vars()
extract_cmd="$tar_cmd xf $dfile -C $PKGFS_BUILDDIR"
;;
.zip)
extract_cmd="$unzip_cmd -x $dfile -C $PKGFS_BUILDDIR"
if [ -f "$PKGFS_TMPLHELPDIR/unzip-extraction.sh" ]; then
. $PKGFS_TMPLHELPDIR/unzip-extraction.sh
fi
# $unzip_cmd set by the helper.
extract_cmd="$unzip_cmd -x $dfile -d $PKGFS_BUILDDIR"
;;
*)
echo -n "*** ERROR: unknown 'extract_sufx' argument in build "
@ -524,6 +526,15 @@ build_tmpl_sources()
elif [ "$build_style" = "perl_module" ]; then
. $PKGFS_TMPLHELPDIR/perl-module.sh
perl_module_build $pkgname
#
# Packages with BSD or GNU Makefiles are easy, just skip
# the configure stage and proceed.
#
elif [ "$build_style" = "bsd_makefile" -o \
"$build_style" = "gnu_makefile" ]; then
cd $wrksrc
#
# Unknown build_style type won't work :-)
#
@ -537,10 +548,11 @@ build_tmpl_sources()
exit 1
fi
#
# Assume BSD make if make_cmd not set in template.
#
if [ -z "$make_cmd" ]; then
MAKE_CMD="/usr/bin/make"
else
MAKE_CMD="$make_cmd"
make_cmd="/usr/bin/make"
fi
# Fixup libtool script if necessary
@ -561,7 +573,7 @@ build_tmpl_sources()
#
# Build package via make.
#
${MAKE_CMD} ${make_build_args} ${make_build_target}
${make_cmd} ${make_build_args} ${make_build_target}
if [ "$?" -ne 0 ]; then
echo "*** ERROR building (make stage) \`$pkgname' ***"
exit 1
@ -582,7 +594,7 @@ build_tmpl_sources()
#
# Install package via make.
#
${MAKE_CMD} ${make_install_args} ${make_install_target} \
${make_cmd} ${make_install_args} ${make_install_target} \
prefix="$PKGFS_DESTDIR/$pkgname"
if [ "$?" -ne 0 ]; then
echo "*** ERROR instaling \`$pkgname' ***"

17
templates/jasper-1.900.1.tmpl Executable file
View file

@ -0,0 +1,17 @@
# Template build file for 'jasper-1.900.1'.
pkgname=jasper-1.900.1
extract_sufx=".zip"
url=http://www.ece.uvic.ca/~mdadams/jasper/software
build_style=gnu_configure
export CPPFLAGS="-I$PKGFS_MASTERDIR/include"
configure_args="--enable-shared --without-x --disable-opengl"
short_desc="Software-based reference implementation of the JPEG-2000 codec"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=fb2c188abf5b8c297078ac1f913101734f72db5c
long_desc="
The JasPer Project is a collaborative effort between Image Power, Inc.
and the University of British Columbia. The objective of this project is
to develop a software-based reference implementation of the codec
specified in the JPEG-2000 Part-1 standard (i.e., ISO/IEC 15444-1).This
software has also been submitted to the ISO for inclusion in the JPEG-2000
Part-5 standard (as an official reference implementation)."

View file

@ -0,0 +1,27 @@
$NetBSD: patch-ad,v 1.1 2006/11/03 07:53:55 rillig Exp $
unzipsfx does not need libz, so a special compile rule is needed for it.
--- unix/Makefile.orig Mon Oct 30 22:45:35 2006
+++ unix/Makefile Mon Oct 30 22:48:02 2006
@@ -87,7 +87,7 @@
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
LOBJS = $(OBJS)
OBJSDLL = $(OBJS:.o=.pic.o) api.pic.o
-OBJX = unzipsfx$O $(CRC32)$O crctab_$O crypt_$O extract_$O fileio_$O \
+OBJX = unzipsfx$O crc32_$O crctab_$O crypt_$O extract_$O fileio_$O \
globals_$O inflate_$O match_$O process_$O ttyio_$O $M_$O
LOBJX = $(OBJX)
OBJF = funzip$O $(CRC32)$O cryptf$O globalsf$O inflatef$O ttyiof$O
@@ -306,6 +306,11 @@
-$(CP) unzip.c unzipsfx.c
$(CC) -c $(CF) -DSFX unzipsfx.c
$(RM) unzipsfx.c
+
+crc32_$O: crc32.c $(UNZIP_H) zip.h # unzipsfx only
+ -$(CP) crc32.c crc32_.c
+ $(CC) -c $(CF) -DSFX crc32_.c
+ $(RM) crc32_.c
crctab_$O: crctab.c $(UNZIP_H) zip.h
-$(CP) crctab.c crctab_.c

38
templates/unzip-5.52.tmpl Executable file
View file

@ -0,0 +1,38 @@
# Template file for 'unzip-5.52'
pkgname=unzip-5.52
patch_files=$pkgname-fix-unzipsfx.diff
wrksrc=$pkgname
distfiles=unzip552
extract_sufx=".tgz"
url=ftp://ftp.info-zip.org/pub/infozip/src/
build_style=gnu_makefile
make_cmd="$PKGFS_MASTERDIR/bin/gmake"
make_build_args="-f unix/Makefile"
make_build_target="generic_zlib unzipsfx"
export CFLAGS="-I. -DUNIX -Dunix -DUSE_UNSHRINK"
short_desc="List, test and extract compressed files in a ZIP archive"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=b749b0923bc4cceaa6f937aef688e9713a84328c
long_desc="
Unzip will list, test, or extract files from a ZIP archive, commonly
found on MS-DOS systems. The default behavior (with no options) is to
extract into the current directory (and subdirectories below it) all
files from the specified ZIP archive. Unzip is compatible with
archives created by PKWARE's PKZIP, but in many cases the program
options or default behaviors differ.
Zipinfo lists technical information about files in a ZIP archive, most
commonly found on MS-DOS systems. Such information includes file access
permissions, encryption status, type of compression, version and operating
system or file system of compressing program, and the like.
Funzip acts as a filter; that is, it assumes that a ZIP archive is
being piped into standard input, and it extracts the first member from
the archive to stdout. If there is an argument, then the input comes
from the specified file instead of from stdin.
Unzipsfx is a modified version of unzip designed to be prepended to
existing ZIP archives in order to form self-extracting archives.
Instead of taking its first non-flag argument to be the zipfile(s) to
be extracted, unzipsfx seeks itself under the name by which it was
invoked and tests or extracts the contents of the appended archive."