diff --git a/Makefile.am b/Makefile.am index 21233f69..a49f4709 100644 --- a/Makefile.am +++ b/Makefile.am @@ -115,3 +115,11 @@ testclean: $(RM) *_444Q[0-9]*.bmp $(RM) *_444Q[0-9]*.ppm $(RM) *_444Q[0-9]*.jpg + +rpm: all + sh $(srcdir)/release/makerpm ${PACKAGE_NAME} ${VERSION} ${BUILD} \ + ${RPMARCH} ${srcdir} + +srpm: dist + sh $(srcdir)/release/makesrpm ${PACKAGE_NAME} ${VERSION} ${BUILD} \ + ${srcdir} diff --git a/configure.ac b/configure.ac index 42c7a934..d7217a63 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,7 @@ echo libdir=$libdir AC_PREREQ([2.56]) AC_INIT([libjpeg-turbo], [0.0.90]) +BUILD=`date +%Y%m%d` AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) AC_PREFIX_DEFAULT(/opt/libjpeg-turbo) @@ -129,6 +130,18 @@ AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) +case "$host_cpu" in + x86_64) + RPMARCH=x86_64 + ;; + i*86 | x86 | ia32) + RPMARCH=i386 + ;; +esac + +AC_SUBST(RPMARCH) +AC_SUBST(BUILD) + # jconfig.h is the file we use, but we have another before that to # fool autoheader. the reason is that we include this header in our # API headers, which can screw things up for users of the lib. diff --git a/release/libjpeg-turbo.spec b/release/libjpeg-turbo.spec new file mode 100644 index 00000000..4e73ecc7 --- /dev/null +++ b/release/libjpeg-turbo.spec @@ -0,0 +1,79 @@ +%ifarch x86_64 +%define __lib lib64 +%else +%define __lib lib +%endif + +Summary: A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs +Name: %{_name} +Version: %{_version} +Vendor: The libjpeg-turbo Project +URL: http://libjpeg-turbo.virtualgl.org +Group: System Environment/Libraries +#-->Source0: http://prdownloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz +Release: %{_build} +License: wxWindows Library License, v3.1 +BuildRoot: %{_blddir}/%{name}-buildroot-%{version}-%{release} +Prereq: /sbin/ldconfig +Provides: %{name} = %{version}-%{release}, turbojpeg = 2.00 +Obsoletes: turbojpeg + +%description +libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors +which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG +compression and decompression. libjpeg-turbo is generally 2-4x as fast +as the unmodified version of libjpeg, all else being equal. libjpeg-turbo also +includes a wrapper library for the TurboJPEG API used by VirtualGL and +TurboVNC. + +libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but +the TigerVNC and VirtualGL projects made numerous enhancements to the codec, +including improved support for Mac OS X, 64-bit support, support for 32-bit +and big endian pixel formats, accelerated Huffman encoding/decoding, and +various bug fixes. The goal was to produce a fully open source codec that +could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL +and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of +TurboJPEG/IPP. It is faster in some areas but slower in others. + +#-->%prep +#-->%setup -q + +#-->%build +#-->configure prefix=$RPM_BUILD_ROOT/opt/%{name} libdir=$RPM_BUILD_ROOT/opt/%{name}/%{__lib} +#-->make prefix=$RPM_BUILD_ROOT/opt/%{name} libdir=$RPM_BUILD_ROOT/opt/%{name}/%{__lib} + +%install + +rm -rf $RPM_BUILD_ROOT +make install prefix=$RPM_BUILD_ROOT/opt/%{name} libdir=$RPM_BUILD_ROOT/opt/%{name}/%{__lib} +rm -f $RPM_BUILD_ROOT/opt/%{name}/%{__lib}/*.la +mkdir -p $RPM_BUILD_ROOT/usr/%{__lib} +mv $RPM_BUILD_ROOT/opt/%{name}/%{__lib}/libturbojpeg.* $RPM_BUILD_ROOT/usr/%{__lib} +/sbin/ldconfig -n $RPM_BUILD_ROOT/opt/%{name}/%{__lib} +/sbin/ldconfig -n $RPM_BUILD_ROOT/usr/%{__lib} +mkdir -p $RPM_BUILD_ROOT/usr/include +mv $RPM_BUILD_ROOT/opt/%{name}/include/turbojpeg.h $RPM_BUILD_ROOT/usr/include + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%doc %{_srcdir}/LICENSE.txt %{_srcdir}/LGPL.txt +/opt/%{name}/%{__lib}/libjpeg.so.62.0.0 +/opt/%{name}/%{__lib}/libjpeg.so.62 +/opt/%{name}/%{__lib}/libjpeg.so +/opt/%{name}/%{__lib}/libjpeg.a +/usr/%{__lib}/libturbojpeg.so +/usr/%{__lib}/libturbojpeg.a +/usr/include/turbojpeg.h +/opt/%{name}/include/jconfig.h +/opt/%{name}/include/jerror.h +/opt/%{name}/include/jmorecfg.h +/opt/%{name}/include/jpeglib.h + +%changelog diff --git a/release/makerpm b/release/makerpm new file mode 100644 index 00000000..f45967f9 --- /dev/null +++ b/release/makerpm @@ -0,0 +1,43 @@ +#!/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 +RPMARCH=$4 +if [ "$5" = "" ]; then usage $0; fi +SRCDIR=$5 + +TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX || doexit -1` +mkdir -p $TMPDIR/RPMS || doexit -1 +ln -fs `pwd` $TMPDIR/BUILD || doexit -1 +rm -f $PACKAGE_NAME.$RPMARCH.rpm +rpmbuild -bb --define "_name $PACKAGE_NAME" \ + --define "_blddir $TMPDIR/buildroot" --define "_topdir $TMPDIR" \ + --define "_version $VERSION" --define "_build $BUILD" \ + --define "_srcdir $SRCDIR" --target $RPMARCH \ + $SRCDIR/release/libjpeg-turbo.spec || doexit -1 +cp $TMPDIR/RPMS/$RPMARCH/$PACKAGE_NAME-$VERSION-$BUILD.$RPMARCH.rpm $PACKAGE_NAME.$RPMARCH.rpm + +doexit 0 diff --git a/release/makesrpm b/release/makesrpm new file mode 100644 index 00000000..b2476bbf --- /dev/null +++ b/release/makesrpm @@ -0,0 +1,51 @@ +#!/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 +SRCDIR=$4 + +TARBALL=$PACKAGE_NAME-$VERSION.tar.gz +if [ ! -f ./$TARBALL ]; then + echo ./$TARBALL does not exist. Run make dist first. + exit -1 +fi + +TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX || doexit -1` +mkdir -p $TMPDIR/RPMS || doexit -1 +mkdir -p $TMPDIR/SRPMS || doexit -1 +mkdir -p $TMPDIR/BUILD || doexit -1 +mkdir -p $TMPDIR/SOURCES || doexit -1 +mkdir -p $TMPDIR/SPECS || doexit -1 +rm -f $PACKAGE_NAME.src.rpm +cp $TARBALL $TMPDIR/SOURCES +cat $SRCDIR/release/libjpeg-turbo.spec | sed s/%{_name}/$PACKAGE_NAME/g \ + | sed s/%{_version}/$VERSION/g | sed s/%{_build}/$BUILD/g \ + | sed s/%{_blddir}/%{_tmppath}/g | sed s@%{_srcdir}/@@g \ + | sed s/#--\>//g >$TMPDIR/SPECS/libjpeg-turbo.spec || doexit -1 +rpmbuild -bs --define "_topdir $TMPDIR" $TMPDIR/SPECS/libjpeg-turbo.spec || doexit -1 +cp $TMPDIR/SRPMS/$PACKAGE_NAME-$VERSION-$BUILD.src.rpm $PACKAGE_NAME.src.rpm + +doexit 0