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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
#! /bin/sh
## debian/rules for SHOOP
## by Gergely Nagy <algernon@debian.org>
##
## Trapped in time
## A miracle of hope and change
## A swirling mass, no mercy now
## If the truth hurts prepare for pain
## ...Do you think we're forever ?
##
## - Anathema: Eternity Part I
# exports
export SHOOPPATH=${PWD}:${PWD}/modules
export SHOOPMOD=${PWD}/modules
export DH_COMPAT=2
# #include <shoop>
. ${PWD}/shoop.sh
# basic setup
OBJECT . new DEBIAN
DEBIAN . MAKE_LEVEL =q 0
DEBIAN . dry_run =q no
DEBIAN . verbose =q yes
DEBIAN . keep_going =q no
DEBIAN . DPKG_BUILDPACKAGE =q ${DPKG_BUILDPACKAGE:-dpkg-buildpackage}
DEBIAN . INSTALL_OPTIONS =q ""
# core methods
DEBIAN . do_header : 'echo "==> [$($THIS . MAKE_LEVEL)] Making $@" 1>&2
$THIS . MAKE_LEVEL =q $(expr $($THIS . MAKE_LEVEL) + 1)'
DEBIAN . do_done : '$THIS . MAKE_LEVEL =q $(expr $($THIS . MAKE_LEVEL) - 1)
echo "<== [$($THIS . MAKE_LEVEL)] Finished $@" 1>&2'
DEBIAN . do : 'if test "x$($THIS . verbose)" != "xno"; then echo $@; fi
if test "x$($THIS . dry_run)" = "xno"; then eval $@; fi'
DEBIAN . header : 'if test "x$($THIS . verbose)" != "xno"; then
$THIS . do_header $@
fi'
DEBIAN . done : 'if test "x$($THIS . verbose)" != "xno"; then
$THIS . do_done $@
fi'
# These do the Real Job
DEBIAN . do_build : 'test -f build-stamp || $THIS . build_stamp'
DEBIAN . do_build_stamp : '$THIS . do dh_testdir
$THIS . do "make docs/modules.txt 2>/dev/null"
$THIS . do touch build-stamp'
DEBIAN . do_clean : '$THIS . do dh_testdir
$THIS . do dh_testroot
$THIS . do rm -f build-stamp docs/modules.txt docs/modules.pod
# Back up the ChangeLog
mv ChangeLog ChangeLog.backup
# Clean up!
$THIS . do "make clean || true"
# Copy the ChangeLog back
mv ChangeLog.backup ChangeLog
$THIS . do dh_clean'
DEBIAN . do_install : '$THIS . build
$THIS . do dh_testdir
$THIS . do dh_testroot
$THIS . do dh_clean -k
$THIS . do dh_installdirs
$THIS . do make install $($THIS . INSTALL_OPTIONS)
$THIS . do rm -f debian/shoop/usr/share/doc/shoop/COPYING \
debian/shoop/usr/share/doc/shoop/COPYING.gz
$THIS . do mv debian/shoop/usr/share/shoop/modules \
debian/shoop-modules/usr/share/shoop/modules
$THIS . do mv debian/shoop/usr/share/doc/shoop/modules.txt \
debian/shoop-dev/usr/share/doc/shoop/
$THIS . do mv debian/shoop/usr/share/doc/shoop/MODULES \
debian/shoop-dev/usr/share/doc/shoop/
$THIS . do rm -rf debian/shoop/usr/share/doc/shoop/examples
$THIS . do ln -sf shoop debian/shoop-dev/usr/share/doc/shoop-dev
$THIS . do ln -sf shoop debian/shoop-modules/usr/share/doc/shoop-modules
# I have to use ugly IFS magic here, otherwise things would fail miserably
SAVE_IFS="$IFS"
GOOD_IFS="
"
IFS="$GOOD_IFS"
for f in $(cat debian/shoop-dev.examples); do
IFS="$SAVE_IFS"
$THIS . do cp $f debian/shoop-dev/usr/share/doc/shoop/examples/$f
IFS="$GOOD_IFS"
done
IFS="$SAVE_IFS"'
DEBIAN . do_packages : '$THIS . build
$THIS . install
$THIS . do dh_testdir
$THIS . do dh_testroot
# $THIS . do dh_installdebconf
$THIS . do dh_installdocs
# $THIS . do dh_installmenu
# $THIS . do dh_installinfo
$THIS . do dh_installchangelogs
# This is Evil.
$THIS . do rm -f debian/shoop-dev/usr/share/doc/shoop/copyright
$THIS . do rm -f debian/shoop-dev/usr/share/doc/shoop/changelog{,.gz}
$THIS . do rm -f debian/shoop-modules/usr/share/doc/shoop/copyright
$THIS . do rm -f debian/shoop-modules/usr/share/doc/shoop/changelog{,.gz}
# Evil ends here.
$THIS . do dh_link
$THIS . do dh_strip
$THIS . do dh_compress
$THIS . do dh_fixperms
$THIS . do dh_installdeb
$THIS . do dh_gencontrol
$THIS . do dh_md5sums
$THIS . do dh_builddeb'
DEBIAN . do_binary_arch : ''
DEBIAN . do_binary_indep : '$THIS . packages'
DEBIAN . do_binary : '$THIS . binary_arch
$THIS . binary_indep'
DEBIAN . do_cvs_build : '# Oh boy, oh boy!
$THIS . do make ChangeLog
$THIS . do $($THIS . DPKG_BUILDPACKAGE)'
# Wrapper function that calls header & done too
DEBIAN . do_func : '$THIS . header $LASTMETH
$THIS . do_$LASTMETH
$THIS . done $LASTMETH'
# Use the wrapper for all targets
DEBIAN . build : DEBIAN . do_func
DEBIAN . build_stamp : DEBIAN . do_func
DEBIAN . clean : DEBIAN . do_func
DEBIAN . install : DEBIAN . do_func
DEBIAN . packages : DEBIAN . do_func
DEBIAN . binary_arch : DEBIAN . do_func
DEBIAN . binary_indep : DEBIAN . do_func
DEBIAN . binary : DEBIAN . do_func
DEBIAN . cvs_build : DEBIAN . do_func
# void main ( whatever )
DEBIAN . debian : '# Go Johny, go! Go Johny, go go go!
while test $# -gt 0
do
opt=$1
shift
case $opt in
build|build-stamp|clean|install|packages|binary-arch|binary-indep|binary|cvs-build)
method=$(echo $opt | sed -e "s,\-,_,g")
$THIS . TODO .=q $method
;;
DEB_BUILD_OPTIONS=*nostrip*)
$THIS . INSTALL_OPTIONS .=q "strip_comment_space=/bin/cat"
;;
DEB_*=*)
# These are useless for us
;;
-*b*|-*m*|-*d*|-*e*|-*i*|-*p*|-*q*|-*r*|-*t*|-*w*|-*C|-*f|-*I|-*o|-*W|-*j*|-*k*|-*s*|-*S-|-*n*|-*l*)
# Ignored, handled later
;;
-*)
echo "*** Unsupported option: $opt"
exit 1
;;
*)
echo "*** Unsupported target: $opt"
exit 1
;;
esac
case $opt in
-*b*|-*m*|-*d*|-*e*|-*i*|-*p*|-*q*|-*r*|-*t*|-*w*)
# Ignored for GNU Make compatibility
;;
esac
case $opt in
-*C|-*f|-*I|-*o|-*W|-*l)
# Ignored (with arguments) for GNU Make compatibility
shift
;;
esac
case $opt in
-*j*)
# This is not implemented yet
;;
esac
case $opt in
-*k*)
$THIS . keep_going =q yes
;;
esac
case $opt in
-*S*)
$THIS . keep_going =q no
;;
esac
case $opt in
-*n*)
$THIS . dry_run =q yes
;;
esac
case $opt in
-*s*)
$THIS . verbose =q no
;;
esac
case $opt in
-*v*)
$ THIS . version
exit 0
;;
esac
done
$THIS . header debian
if test "x$($THIS . keep_going)" = "xno"; then
set -e
fi
# FIXME : $THIS . TODO empty => print warning
for rule in $($THIS . TODO); do
$THIS . $rule
done
$THIS . done debian'
# Run forest, run !
DEBIAN . debian ${@:-build}
exit 0
|