contrib updates
[sxemacs] / contrib / make-pkg.sh
1 #!/bin/sh
2 #
3 echo "Complain bitterly to njsf@sxemacs.org that he has still NOT updated this script to use git"
4 exit 1
5 if [ ! -n "$1" ]; then
6     echo "Usage: $0 <package-name> [<package-location>]"
7     echo "Example: $0 sxemacs-22.1.9"
8     exit 1
9 fi
10 type tla >/dev/null 2>&1 && TLA=tla
11 if [ -z "${TLA}" ]; then
12     echo "Cannot find tla."
13     exit 1
14 fi
15 BASE=$(basename $1)
16 BASE=$(echo ${BASE} | sed -e 's/\.tgz$//g' -e 's/\.tar\.gz$//g' -e 's/\.tar$//g')
17 if [ ! -f ./autogen.sh -o ! -f ./sxemacs.pc.in ]; then
18     echo "Please run this script from the top of the sxemacs source directory.\n"
19     exit 1;
20 fi
21 STATUS=""
22 if [ -z "MAKEPKGYES" ]; then
23     echo "The next step will erase ALL files not under source control from the source tree"
24     echo -n "Continue [Y/N]"
25     read YN
26 else
27     YN="y"
28 fi
29 YN=$(echo ${YN} | tr [:upper:] [:lower:])
30 if [ "$YN" != "y" -a "$YN" != "yes" ]; then
31     echo "Stopping."
32     exit 1;
33 fi
34 ${TLA} export "/tmp/${1}" || STATUS="FAIL_EXPORT"
35 if [ -n "$STATUS" ]; then
36     echo "Either your tla does not support export or it failed to create the destination"
37     exit 1
38 fi
39 HAMMER=BHFH ./autogen.sh || STATUS="FAIL_AUTOGEN"
40 if [ -n "$STATUS" ]; then
41     echo "The autogen process failed"
42     exit 1
43 fi
44 for f in $(${TLA} inventory -p -B); do
45     cp -r -v --parents "${f}" "/tmp/${1}"
46 done
47 ${TLA} changelog --untagged > "/tmp/${1}/ChangeLog" || STATUS="FAIL_CHANGELOG"
48 if [ -n "$STATUS" ]; then
49     echo "The changelog generation failed. Continuing..."
50     STATUS=""
51 fi
52 CURDIR="$(pwd)"
53 if [ -n "$2"  ]; then
54     cd "$2"
55 else
56     echo "Using ${CURDIR} as package destination"
57 fi
58 DEST="$(pwd)/${BASE}.tar.gz"
59 cd /tmp
60 tar --create --owner=0 --group=0 --gzip --file "${DEST}" "${BASE}"
61 md5sum "${DEST}" > "${DEST}.md5"
62 /bin/rm -rf "${BASE}"
63 cd "$CURDIR"
64 echo "Done"
65