aboutsummaryrefslogtreecommitdiff
path: root/release/makesunpkg.in
blob: 3331dab02fda20b3306ae9a311fad562657f91ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/sh

set -u
set -e
trap onexit INT
trap onexit TERM
trap onexit EXIT

TMPDIR=

onexit()
{
	if [ ! "$TMPDIR" = "" ]; then
		rm -rf $TMPDIR
	fi
}

usage()
{
	echo "$0 [combined [32-bit build dir.]]"
	exit 1
}

COMBINED=0

PACKAGE_NAME=@PACKAGE_NAME@
VERSION=@VERSION@
BUILD=@BUILD@
PKGARCH=@DEBARCH@
SRCDIR=@abs_top_srcdir@
BUILDDIR32=@abs_top_srcdir@/solx86
WITH_JAVA=@WITH_JAVA@
if [ $# -gt 0 ]; then
	if [ "$1" = "combined" ]; then
		COMBINED=1
		if [ $# -gt 1 ]; then	BUILDDIR32=$2; fi
	fi
fi

umask 022
TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
rm -f $PACKAGE_NAME.pkg.bz2
cp $SRCDIR/release/copyright $TMPDIR
touch $TMPDIR/depend
cp pkgscripts/pkginfo $TMPDIR/pkginfo 

if [ "$PKGARCH" = "i386" ]; then
	__LIB=lib
else
	__LIB=lib/$PKGARCH
fi

if [ $COMBINED = 1 ]; then
	if [ ! -d $BUILDDIR32 ]; then
		echo ERROR: 32-bit build directory $BUILDDIR32 does not exist
		exit 1
	fi
	if [ ! -f $BUILDDIR32/Makefile ]; then
		echo ERROR: 32-bit build directory $BUILDDIR32 is not configured
		exit 1
	fi
	PWD=`pwd`
	cd $BUILDDIR32
	make install DESTDIR=$TMPDIR mandir=/opt/$PACKAGE_NAME/man AM_MAKEFLAGS="mandir=/opt/$PACKAGE_NAME/man"
	cd $PWD
fi
# This mess is to work around a bug in /usr/ccs/bin/make
make install DESTDIR=$TMPDIR libdir=/opt/$PACKAGE_NAME/$__LIB mandir=/opt/$PACKAGE_NAME/man AM_MAKEFLAGS="libdir=/opt/$PACKAGE_NAME/$__LIB mandir=/opt/$PACKAGE_NAME/man"
rm -f $TMPDIR/opt/$PACKAGE_NAME/$__LIB/*.la
mkdir -p $TMPDIR/opt/$PACKAGE_NAME/doc
cp $SRCDIR/README-turbo.txt $SRCDIR/README $SRCDIR/libjpeg.txt $SRCDIR/usage.txt $TMPDIR/opt/$PACKAGE_NAME/doc
chmod 644 $TMPDIR/opt/$PACKAGE_NAME/doc/*

cat >$TMPDIR/proto <<EOF
i copyright
i depend
i pkginfo
d none $PACKAGE_NAME 0755 root bin
d none $PACKAGE_NAME/bin 0755 root bin
f none $PACKAGE_NAME/bin/cjpeg 0755 root bin
f none $PACKAGE_NAME/bin/djpeg 0755 root bin
f none $PACKAGE_NAME/bin/jpegtran 0755 root bin
f none $PACKAGE_NAME/bin/tjbench 0755 root bin
f none $PACKAGE_NAME/bin/rdjpgcom 0755 root bin
f none $PACKAGE_NAME/bin/wrjpgcom 0755 root bin
d none $PACKAGE_NAME/lib 0755 root bin
EOF
if [ $COMBINED = 1 ]; then
cat >>$TMPDIR/proto <<EOF
f none $PACKAGE_NAME/lib/libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@ 0755 root bin
s none $PACKAGE_NAME/lib/libjpeg.so.@SO_MAJOR_VERSION@=libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@
s none $PACKAGE_NAME/lib/libjpeg.so=libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@
f none $PACKAGE_NAME/lib/libjpeg.a 0644 root bin
f none $PACKAGE_NAME/lib/libturbojpeg.so 0755 root bin
f none $PACKAGE_NAME/lib/libturbojpeg.a 0644 root bin
EOF
fi
if [ "${__LIB}" != "lib" ]; then
echo d none $PACKAGE_NAME/${__LIB} 0755 root bin >>$TMPDIR/proto
echo s none $PACKAGE_NAME/lib64=${__LIB} >>$TMPDIR/proto
echo s none $PACKAGE_NAME/lib/64=$PKGARCH >>$TMPDIR/proto
fi
cat >>$TMPDIR/proto <<EOF
f none $PACKAGE_NAME/${__LIB}/libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@ 0755 root bin
s none $PACKAGE_NAME/${__LIB}/libjpeg.so.@SO_MAJOR_VERSION@=libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@
s none $PACKAGE_NAME/${__LIB}/libjpeg.so=libjpeg.so.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@
f none $PACKAGE_NAME/${__LIB}/libjpeg.a 0644 root bin
f none $PACKAGE_NAME/${__LIB}/libturbojpeg.so 0755 root bin
f none $PACKAGE_NAME/${__LIB}/libturbojpeg.a 0644 root bin
s none $PACKAGE_NAME/lib32=lib
d none $PACKAGE_NAME/man 0755 root bin
d none $PACKAGE_NAME/man/man1 0755 root bin
d none $PACKAGE_NAME/man/man1/cjpeg.1 0644 root bin
d none $PACKAGE_NAME/man/man1/djpeg.1 0644 root bin
d none $PACKAGE_NAME/man/man1/jpegtran.1 0644 root bin
d none $PACKAGE_NAME/man/man1/rdjpgcom.1 0644 root bin
d none $PACKAGE_NAME/man/man1/wrjpgcom.1 0644 root bin
d none $PACKAGE_NAME/include 0755 root bin
f none $PACKAGE_NAME/include/jconfig.h 0644 root bin
f none $PACKAGE_NAME/include/jerror.h 0644 root bin
f none $PACKAGE_NAME/include/jmorecfg.h 0644 root bin
f none $PACKAGE_NAME/include/jpeglib.h 0644 root bin
f none $PACKAGE_NAME/include/turbojpeg.h 0644 root bin
d none $PACKAGE_NAME/doc 0755 root bin
f none $PACKAGE_NAME/doc/libjpeg.txt 0644 root bin
f none $PACKAGE_NAME/doc/README 0644 root bin
f none $PACKAGE_NAME/doc/README-turbo.txt 0644 root bin
f none $PACKAGE_NAME/doc/usage.txt 0644 root bin
EOF
if [ $WITH_JAVA = 1 ]; then
echo d none $PACKAGE_NAME/classes 0755 root bin >>$TMPDIR/proto
echo f none $PACKAGE_NAME/classes/turbojpeg.jar 0644 root bin >>$TMPDIR/proto
fi

pkgmk -o -r $TMPDIR/opt -d $TMPDIR -a i386 -f $TMPDIR/proto
pkgtrans -s $TMPDIR $TMPDIR/$PACKAGE_NAME-$VERSION.pkg $PACKAGE_NAME
bzip2 $TMPDIR/$PACKAGE_NAME-$VERSION.pkg
cp $TMPDIR/$PACKAGE_NAME-$VERSION.pkg.bz2 . 

exit