Add mechanism for creating RPMs

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@98 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC 2010-02-15 11:32:23 +00:00
Родитель 6f52592267
Коммит 079b4346bc
5 изменённых файлов: 194 добавлений и 0 удалений

Просмотреть файл

@ -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}

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

43
release/makerpm Normal file
Просмотреть файл

@ -0,0 +1,43 @@
#!/bin/sh
set -u
TMPDIR=
doexit()
{
if [ ! "$TMPDIR" = "" ]; then
sudo rm -rf $TMPDIR
fi
exit $1
}
usage()
{
echo "$0 <package name> <version> <build> <RPM 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
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

51
release/makesrpm Normal file
Просмотреть файл

@ -0,0 +1,51 @@
#!/bin/sh
set -u
TMPDIR=
doexit()
{
if [ ! "$TMPDIR" = "" ]; then
sudo rm -rf $TMPDIR
fi
exit $1
}
usage()
{
echo "$0 <package name> <version> <build> <RPM 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
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