Imported Upstream version 1.2.1
[platform/upstream/libjpeg-turbo.git] / release / makesunpkg.in
1 #!/bin/sh
2
3 set -u
4 set -e
5 trap onexit INT
6 trap onexit TERM
7 trap onexit EXIT
8
9 TMPDIR=
10
11 onexit()
12 {
13         if [ ! "$TMPDIR" = "" ]; then
14                 rm -rf $TMPDIR
15         fi
16 }
17
18 usage()
19 {
20         echo "$0 [combined [32-bit build dir.]]"
21         exit 1
22 }
23
24 COMBINED=0
25
26 PACKAGE_NAME=@PACKAGE_NAME@
27 VERSION=@VERSION@
28 BUILD=@BUILD@
29 PKGARCH=@DEBARCH@
30 SRCDIR=@abs_top_srcdir@
31 BUILDDIR32=@abs_top_srcdir@/solx86
32 WITH_JAVA=@WITH_JAVA@
33 if [ $# -gt 0 ]; then
34         if [ "$1" = "combined" ]; then
35                 COMBINED=1
36                 if [ $# -gt 1 ]; then   BUILDDIR32=$2; fi
37         fi
38 fi
39
40 umask 022
41 TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
42 rm -f $PACKAGE_NAME.pkg.bz2
43 cp $SRCDIR/release/copyright $TMPDIR
44 touch $TMPDIR/depend
45 cp pkgscripts/pkginfo $TMPDIR/pkginfo 
46
47 if [ "$PKGARCH" = "i386" ]; then
48         __LIB=lib
49 else
50         __LIB=lib/$PKGARCH
51 fi
52
53 if [ $COMBINED = 1 ]; then
54         if [ ! -d $BUILDDIR32 ]; then
55                 echo ERROR: 32-bit build directory $BUILDDIR32 does not exist
56                 exit 1
57         fi
58         if [ ! -f $BUILDDIR32/Makefile ]; then
59                 echo ERROR: 32-bit build directory $BUILDDIR32 is not configured
60                 exit 1
61         fi
62         PWD=`pwd`
63         cd $BUILDDIR32
64         make install DESTDIR=$TMPDIR mandir=/opt/$PACKAGE_NAME/man AM_MAKEFLAGS="mandir=/opt/$PACKAGE_NAME/man"
65         cd $PWD
66 fi
67 # This mess is to work around a bug in /usr/ccs/bin/make
68 make install DESTDIR=$TMPDIR libdir=/opt/$PACKAGE_NAME/$__LIB \
69         mandir=/opt/$PACKAGE_NAME/man docdir=/opt/$PACKAGE_NAME/doc \
70         exampledir=/opt/$PACKAGE_NAME/doc \
71         AM_MAKEFLAGS="libdir=/opt/$PACKAGE_NAME/$__LIB mandir=/opt/$PACKAGE_NAME/man docdir=/opt/$PACKAGE_NAME/doc exampledir=/opt/$PACKAGE_NAME/doc"
72 rm -f $TMPDIR/opt/$PACKAGE_NAME/$__LIB/*.la
73
74 cat >$TMPDIR/proto <<EOF
75 i copyright
76 i depend
77 i pkginfo
78 d none $PACKAGE_NAME 0755 root bin
79 d none $PACKAGE_NAME/bin 0755 root bin
80 f none $PACKAGE_NAME/bin/cjpeg 0755 root bin
81 f none $PACKAGE_NAME/bin/djpeg 0755 root bin
82 f none $PACKAGE_NAME/bin/jpegtran 0755 root bin
83 f none $PACKAGE_NAME/bin/tjbench 0755 root bin
84 f none $PACKAGE_NAME/bin/rdjpgcom 0755 root bin
85 f none $PACKAGE_NAME/bin/wrjpgcom 0755 root bin
86 d none $PACKAGE_NAME/lib 0755 root bin
87 EOF
88 if [ $COMBINED = 1 ]; then
89 cat >>$TMPDIR/proto <<EOF
90 f none $PACKAGE_NAME/lib/libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@ 0755 root bin
91 s none $PACKAGE_NAME/lib/libjpeg.so.@SO_MAJOR_VERSION@=libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@
92 s none $PACKAGE_NAME/lib/libjpeg.so=libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@
93 f none $PACKAGE_NAME/lib/libjpeg.a 0644 root bin
94 f none $PACKAGE_NAME/lib/libturbojpeg.so 0755 root bin
95 f none $PACKAGE_NAME/lib/libturbojpeg.a 0644 root bin
96 EOF
97 fi
98 if [ "${__LIB}" != "lib" ]; then
99 echo d none $PACKAGE_NAME/${__LIB} 0755 root bin >>$TMPDIR/proto
100 echo s none $PACKAGE_NAME/lib64=${__LIB} >>$TMPDIR/proto
101 echo s none $PACKAGE_NAME/lib/64=$PKGARCH >>$TMPDIR/proto
102 fi
103 cat >>$TMPDIR/proto <<EOF
104 f none $PACKAGE_NAME/${__LIB}/libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@ 0755 root bin
105 s none $PACKAGE_NAME/${__LIB}/libjpeg.so.@SO_MAJOR_VERSION@=libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@
106 s none $PACKAGE_NAME/${__LIB}/libjpeg.so=libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@
107 f none $PACKAGE_NAME/${__LIB}/libjpeg.a 0644 root bin
108 f none $PACKAGE_NAME/${__LIB}/libturbojpeg.so 0755 root bin
109 f none $PACKAGE_NAME/${__LIB}/libturbojpeg.a 0644 root bin
110 s none $PACKAGE_NAME/lib32=lib
111 d none $PACKAGE_NAME/man 0755 root bin
112 d none $PACKAGE_NAME/man/man1 0755 root bin
113 d none $PACKAGE_NAME/man/man1/cjpeg.1 0644 root bin
114 d none $PACKAGE_NAME/man/man1/djpeg.1 0644 root bin
115 d none $PACKAGE_NAME/man/man1/jpegtran.1 0644 root bin
116 d none $PACKAGE_NAME/man/man1/rdjpgcom.1 0644 root bin
117 d none $PACKAGE_NAME/man/man1/wrjpgcom.1 0644 root bin
118 d none $PACKAGE_NAME/include 0755 root bin
119 f none $PACKAGE_NAME/include/jconfig.h 0644 root bin
120 f none $PACKAGE_NAME/include/jerror.h 0644 root bin
121 f none $PACKAGE_NAME/include/jmorecfg.h 0644 root bin
122 f none $PACKAGE_NAME/include/jpeglib.h 0644 root bin
123 f none $PACKAGE_NAME/include/turbojpeg.h 0644 root bin
124 d none $PACKAGE_NAME/doc 0755 root bin
125 f none $PACKAGE_NAME/doc/README 0644 root bin
126 f none $PACKAGE_NAME/doc/README-turbo.txt 0644 root bin
127 f none $PACKAGE_NAME/doc/example.c 0644 root bin
128 f none $PACKAGE_NAME/doc/libjpeg.txt 0644 root bin
129 f none $PACKAGE_NAME/doc/structure.txt 0644 root bin
130 f none $PACKAGE_NAME/doc/usage.txt 0644 root bin
131 f none $PACKAGE_NAME/doc/wizard.txt 0644 root bin
132 EOF
133 if [ $WITH_JAVA = 1 ]; then
134 echo d none $PACKAGE_NAME/classes 0755 root bin >>$TMPDIR/proto
135 echo f none $PACKAGE_NAME/classes/turbojpeg.jar 0644 root bin >>$TMPDIR/proto
136 fi
137
138 pkgmk -o -r $TMPDIR/opt -d $TMPDIR -a i386 -f $TMPDIR/proto
139 pkgtrans -s $TMPDIR $TMPDIR/$PACKAGE_NAME-$VERSION.pkg $PACKAGE_NAME
140 bzip2 $TMPDIR/$PACKAGE_NAME-$VERSION.pkg
141 cp $TMPDIR/$PACKAGE_NAME-$VERSION.pkg.bz2 . 
142
143 exit