This is based on a script written during p2k10 (when jasper@ and i
moved all hs-libraries from lib to lib/ghc). I'm using it for ages
to generate the exec/unexec lines in hs-ports (and recently to work
around some flaws in update-plist, but espie@ is currently working
on that one).
I'm using it for updates (after make update-plist) and even for new
hs-ports (after make plist) to get the @exec/@unexec lines in place.
#!/bin/sh
if [ $# -eq 0 ]; then
set pkg/PLIST
fi
for plist; do
ed -s "$plist" <<- 'EOF'
g/\${FULLPKGNAME}/s/\${FULLPKGNAME}/hs-${DISTNAME}/g
g/^@exec .*%D\/lib\/ghc\/\${DISTNAME}\/register\.sh/d
g/^@unexec .*%D\/lib\/ghc\/\${DISTNAME}\/unregister\.sh/d
/^lib\/ghc\/\${DISTNAME}\/register\.sh$/a
@exec /usr/bin/env HOME=/nonexistent
%D/lib/ghc/${DISTNAME}/register.sh -v0
@unexec /usr/bin/env HOME=/nonexistent
%D/lib/ghc/${DISTNAME}/unregister.sh -v0 --force
.
wq
EOF
done