summaryrefslogtreecommitdiff
path: root/pkg/mkpkg.sun
blob: 7dc7da120a643d01a709dbcc89f497bfcc0baeab (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
141
142
143
144
145
146
147
148
149
150
151
152
#! /bin/sh

# Time-stamp:        "2010-02-24 08:37:12 bkorb"
##
##  This file is part of AutoGen.
##  AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
##
##  AutoGen is free software: you can redistribute it and/or modify it
##  under the terms of the GNU General Public License as published by the
##  Free Software Foundation, either version 3 of the License, or
##  (at your option) any later version.
##
##  AutoGen is distributed in the hope that it will be useful, but
##  WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
##  See the GNU General Public License for more details.
##
##  You should have received a copy of the GNU General Public License along
##  with this program.  If not, see <http://www.gnu.org/licenses/>.

case "${VERBOSE}" in
"" | f* | F* | n* | N* )
   VERBOSE=false ;;
*) VERBOSE=true  ; set -x ;;
esac
export VERBOSE

set -e
pkgsrc=`pwd`
agdir=`cd ../agen5 > /dev/null 2>&1 ; pwd`

[ ! -d ${DESTDIR} ] || rm -rf ${DESTDIR} || exit 1
mkdir ${DESTDIR} || exit 1
DESTDIR=`cd ${DESTDIR} > /dev/null && pwd` || exit 1

cd ${top_builddir}
${MAKE} install DESTDIR=${DESTDIR}

cd ${DESTDIR}

if [ ! -d reloc ]
then
  mkdir reloc
  case "${prefix}" in
  /* ) : ;;
  *  ) prefix="/${prefix}" ;;
  esac
  mv .${prefix}/* reloc/. || exit 1
  p=${prefix}
  while [ -n "$p" ]
  do rmdir .${p}
     p=`echo "$p" | sed 's,/[^/]*$,,'`
  done
fi

cp -f ${top_srcdir}/COPYING ./copyright

pkgdst=`pwd`
[ -f prototype ] && rm -f prototype
exec 4> prototype
cat >&4 <<-  EOF
	#  Prototype file for AutoGen
	#
	#  derived by scanning the `pwd` directory

	i copyright
	i pkginfo
	i prototype
	i checkinstall
	! default 0755 root sys

	# pt tp ????  obj-name
	EOF

cd reloc

find * -type d | \
while read d
do
  case "$d" in
  *autogen* ) mod="0775 root sys" ;;
  *         ) mod="? ? ?" ;;
  esac

  echo "  1  d  none ${d} ${mod}"
done >&4

echo "! default 0644 root sys" >&4

find * -type f | \
while read f
do
  if [ -x "$f" ]
  then mod=0755
  else mod=0644 ; fi
  echo "  1  f  none ${f} $mod root sys"
done >&4

find * -type l | \
while read l
do
  f=`ls -l $l | sed 's,.* -> ,,'`
  echo "  1  s  none ${l}=${f}"
done >&4

exec 4>&-
cd ${pkgdst}

cat > checkinstall <<- EOF
	PATH=${PATH}:${prefix}/bin
	guile-config compile > /dev/null 2>&1 && exit 0
	guile -c '(quit "bye")' && exit 0
	echo "The guile library does not seem to be present."
	echo "I have searched the PATH ${PATH}"
	echo "If it is, please ensure it is in the search path and retry."
	exit 1
	EOF

[ -f pkginfo.tpl ] && rm -f pkginfo.tpl
cat > pkginfo.tpl <<- EOF
	[= AutoGen5 Template info=pkginfo =]
	PKG="GNUagen"
	NAME="AutoGen - [=prog-title=]"
	VERSION="[= version =]"
	BASEDIR="${prefix}"
	DESC="AutoGen - [=prog-title=]"
	VENDOR="[= copyright.owner =] http://autogen.sf.net"
	ARCH="sparc"
	CATEGORY="Development"
	EMAIL="[= copyright.eaddr =]"
	CONTACT="[= copyright.owner =]"
	CLASSES=none
	PSTAMP="[= version =] `date '+%Y-%m-%d %H:%M:%S'`"
	EOF

cd ${agdir}
${AGexe} --writable -L${pkgdst} -Tpkginfo.tpl ${top_srcdir}/agen5/opts.def
mv -f pkginfo ${pkgdst}/.
cd ${pkgdst}
rm -f pkginfo.tpl
cd ..
rm -rf GNUagen*
pkgmk -d. -r ${pkgdst}/reloc,${pkgdst} -f ${pkgdst}/prototype
pkgtrans -s . GNUagen.pkg GNUagen
gzip --best GNUagen.pkg
rm -rf ${pkgdst}

## Local Variables:
## mode: shell-script
## indent-tabs-mode: nil
## End:
## end of mkpkg.sun