]> granicus.if.org Git - libjpeg-turbo/commitdiff
Add mechanism for creating DEB packages
authorDRC <dcommander@users.sourceforge.net>
Mon, 15 Feb 2010 12:06:27 +0000 (12:06 +0000)
committerDRC <dcommander@users.sourceforge.net>
Mon, 15 Feb 2010 12:06:27 +0000 (12:06 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@100 632fc199-4ca6-4c93-a231-07263d6284db

Makefile.am
configure.ac
release/makedpkg [new file with mode: 0644]

index c09c9339c8f5e4d28962147a62838689f2021eee..62124a0b05a6109d69ad6557b2692ec2a442d9e5 100644 (file)
@@ -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}
index d7217a6392c391476075df42cd7d498439b0865e..a7bd25806854c0fff77ea216f2d1dcb5b5205ab5 100644 (file)
@@ -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 (file)
index 0000000..8b33f2b
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+set -u
+
+TMPDIR=
+
+doexit()
+{
+       if [ ! "$TMPDIR" = "" ]; then
+               sudo rm -rf $TMPDIR
+       fi
+       exit $1
+}
+
+usage()
+{
+       echo "$0 <package name> <version> <build> <DEB architecture> <source dir.>"
+       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