From: DRC Date: Mon, 15 Feb 2010 12:06:27 +0000 (+0000) Subject: Add mechanism for creating DEB packages X-Git-Tag: 0.0.90~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52a19f25d5144261efbf09d852b176b040b46992;p=libjpeg-turbo Add mechanism for creating DEB packages git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@100 632fc199-4ca6-4c93-a231-07263d6284db --- diff --git a/Makefile.am b/Makefile.am index c09c933..62124a0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -123,3 +123,7 @@ rpm: all srpm: dist-gzip sh $(srcdir)/release/makesrpm ${PACKAGE_NAME} ${VERSION} ${BUILD} \ ${srcdir} + +deb: all + sh $(srcdir)/release/makedpkg ${PACKAGE_NAME} ${VERSION} ${BUILD} \ + ${DEBARCH} ${srcdir} diff --git a/configure.ac b/configure.ac index d7217a6..a7bd258 100644 --- a/configure.ac +++ b/configure.ac @@ -133,13 +133,16 @@ AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) case "$host_cpu" in x86_64) RPMARCH=x86_64 + DEBARCH=amd64 ;; i*86 | x86 | ia32) RPMARCH=i386 + DEBARCH=i386 ;; esac AC_SUBST(RPMARCH) +AC_SUBST(DEBARCH) AC_SUBST(BUILD) # jconfig.h is the file we use, but we have another before that to diff --git a/release/makedpkg b/release/makedpkg new file mode 100644 index 0000000..8b33f2b --- /dev/null +++ b/release/makedpkg @@ -0,0 +1,56 @@ +#!/bin/sh + +set -u + +TMPDIR= + +doexit() +{ + if [ ! "$TMPDIR" = "" ]; then + sudo rm -rf $TMPDIR + fi + exit $1 +} + +usage() +{ + echo "$0 " + exit 1 +} + +if [ "$1" = "" ]; then usage $0; fi +PACKAGE_NAME=$1 +if [ "$2" = "" ]; then usage $0; fi +VERSION=$2 +if [ "$3" = "" ]; then usage $0; fi +BUILD=$3 +if [ "$4" = "" ]; then usage $0; fi +DEBARCH=$4 +if [ "$5" = "" ]; then usage $0; fi +SRCDIR=$5 + +umask 022 +TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX || doexit -1` +mkdir $TMPDIR/DEBIAN || doexit -1 +(cat $SRCDIR/release/deb-control.tmpl | sed s/{__PKGNAME}/$PACKAGE_NAME/g \ + | sed s/{__VERSION}/$VERSION/g | sed s/{__BUILD}/$BUILD/g \ + | sed s/{__ARCH}/$DEBARCH/g > $TMPDIR/DEBIAN/control) || doexit -1 + +if [ "$DEBARCH" = "amd64" ]; then + __LIB=lib +else + __LIB=lib32 +fi +make install prefix=$TMPDIR/opt/$PACKAGE_NAME libdir=$TMPDIR/opt/$PACKAGE_NAME/$__LIB || doexit -1 +rm -f $TMPDIR/opt/$PACKAGE_NAME/$__LIB/*.la || doexit -1 +mkdir -p $TMPDIR/usr/$__LIB || doexit -1 +mv $TMPDIR/opt/$PACKAGE_NAME/$__LIB/libturbojpeg.* $TMPDIR/usr/$__LIB || doexit -1 +/sbin/ldconfig -n $TMPDIR/opt/$PACKAGE_NAME/$__LIB +/sbin/ldconfig -n $TMPDIR/usr/$__LIB +mkdir -p $TMPDIR/usr/include || doexit -1 +mv $TMPDIR/opt/$PACKAGE_NAME/include/turbojpeg.h $TMPDIR/usr/include || doexit -1 + +sudo chown -Rh root:root $TMPDIR/* || doexit -1 +dpkg -b $TMPDIR $PACKAGE_NAME\_$DEBARCH.deb || doexit -1 + +doexit 0