This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
patch to generic-build-script
- From: Lapo Luchini <lapo at lapo dot it>
- To: Mailing List: CygWin-Apps <cygwin-apps at cygwin dot com>
- Date: Mon, 30 Jun 2003 01:31:51 +0200
- Subject: patch to generic-build-script
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I "backported" the changed I was already using in my latest packages the
full diff is in attach (trying to avoid the mailer change it I'm using
an extension DIFFERENT from .txt or anything that could be interpreted
as text/plain...).
Here goes the comment:
| --- templates/generic-build-script 2003-06-13 21:46:59.000000000 +0200
| +++ generic.sh 2003-06-29 23:05:58.000000000 +0200
| @@ -3,8 +3,8 @@
| tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
| test "x$tdir" = "x$0" && tdir=.
| scriptdir=`cd $tdir; pwd`
| -# find src directory.
| -# If scriptdir ends in SPECS, then topdir is $scriptdir/..
| +# find src directory.
| +# If scriptdir ends in SPECS, then topdir is $scriptdir/..
| # If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
| # Otherwise, we assume that topdir = scriptdir
| topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
Just some "trailing spaces stripping" paranoia.
I hate 'em ;-)
| @@ -26,15 +26,25 @@
| export FULLPKG=${PKG}-${VER}-${REL}
|
| # determine correct decompression option and tarball filename
| -if [ -e ${PKG}-${VER}.tar.gz ] ; then
| - export opt_decomp=z
| - export src_orig_pkg_ext=gz
| -elif [ -e ${PKG}-${VER}.tar.bz2 ] ; then
| +export BASEPKG=${PKG}-${VER}
| +if [ -e ${BASEPKG}.tar.bz2 ] ; then
| export opt_decomp=j
| - export src_orig_pkg_ext=bz2
| + export src_orig_pkg_name=${BASEPKG}.tar.bz2
| +elif [ -e ${BASEPKG}.tar.gz ] ; then
| + export opt_decomp=z
| + export src_orig_pkg_name=${BASEPKG}.tar.gz
| +elif [ -e ${BASEPKG}.tgz ] ; then
| + export opt_decomp=z
| + export src_orig_pkg_name=${BASEPKG}.tgz
| +elif [ -e ${BASEPKG}.tar ] ; then
| + export opt_decomp=
| + export src_orig_pkg_name=${BASEPKG}.tar
| +else
| + echo Cannot find original package.
| + exit 1
| fi
|
| -export src_orig_pkg_name=${PKG}-${VER}.tar.${src_orig_pkg_ext}
| +# determine correct names for generated files
| export src_pkg_name=${FULLPKG}-src.tar.bz2
| export src_patch_name=${FULLPKG}.patch
| export bin_pkg_name=${FULLPKG}.tar.bz2
Seems a little more general to me.
Moreover the past script had the "problem" if not having a "else" case,
so if neither .tar.gz nor .tar.bz2 was found it would have continued
with errors.
| @@ -68,7 +78,7 @@
| (cd ${topdir} && \
| tar xv${opt_decomp}f ${src_orig_pkg} ; \
| cd ${topdir} && \
| - patch -p0 < ${src_patch}
| + patch -p0 < ${src_patch}
| && mkdirs )
| }
| conf() {
Again, trailing spaces paranoia.
| @@ -79,8 +89,7 @@
| --exec-prefix=${prefix} --sysconfdir=${sysconfdir} \
| --libdir=${prefix}/lib --includedir=${prefix}/include \
| --libexecdir='${sbindir}' --localstatedir=/var \
| - --datadir='${prefix}/share'
| -)
| + --datadir='${prefix}/share' )
| }
| build() {
| (cd ${objdir} && \
"alla the other closed parens are in line" consistency paranoia.
| @@ -96,7 +105,7 @@
| }
| install() {
| (cd ${objdir} && \
| - make install DESTDIR=${instdir}
| + make install DESTDIR=${instdir}
| if [ -f ${instdir}${prefix}/info/dir ] ; then \
| rm ${instdir}${prefix}/info/dir ; \
| fi && \
I guess "trailing space paranoia".
| @@ -106,9 +115,6 @@
| if [ ! -d ${instdir}${prefix}/doc/Cygwin ]; then \
| mkdir -p ${instdir}${prefix}/doc/Cygwin ; \
| fi && \
| - if [ ! -d ${instdir}${sysconfdir}/postinstall ]; then \
| - mkdir -p ${instdir}${sysconfdir}/postinstall ; \
| - fi && \
| templist=""; \
| for f in ${srcdir}/ANNOUNCE ${srcdir}/CHANGES ${srcdir}/INSTALL \
| ${srcdir}/KNOWNBUG ${srcdir}/LICENSE ${srcdir}/README \
| @@ -131,14 +137,16 @@
| fi ;\
| fi ;\
| if [ -f ${srcdir}/CYGWIN-PATCHES/postinstall.sh ] ; then \
| - /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/postinstall.sh \
| + if [ ! -d ${instdir}${sysconfdir}/postinstall ]; then \
| + mkdir -p ${instdir}${sysconfdir}/postinstall ; \
| + fi && \
| + /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/postinstall.sh \
| ${instdir}${sysconfdir}/postinstall/${PKG}.sh
| fi )
| }
So that postinstall directory is created only if needed.
| strip() {
| (cd ${instdir} && \
| - find . -name "*.dll" | xargs strip > /dev/null 2>&1
| - find . -name "*.exe" | xargs strip > /dev/null 2>&1
| + find . -name "*.dll" -or -name "*.exe" | xargs strip > /dev/null 2>&1
| true )
| }
| pkg() {
"let's save one line and two command execution" paranoia.
| @@ -157,32 +165,70 @@
| }
| spkg() {
| (mkpatch && \
| + if [ "${SIG}" ]; then name=${srcinstdir}/${src_patch_name}
text="PATCH" sigfile; fi && \
| cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
| + if [ -e ${src_orig_pkg}.sig ]; then cp ${src_orig_pkg}.sig
${srcinstdir}/; fi && \
| cp $0 ${srcinstdir}/`basename $0` && \
| + if [ \( "${SIG}" \) -a \( -e $0.sig \) ]; then cp $0.sig
${srcinstdir}/; fi && \
| cd ${srcinstdir} && \
| tar cvjf ${src_pkg} * )
| }
Part of my "optional package signature by mantainer".
(used only when env SIG is defined)
| finish() {
| - rm -rf ${srcdir}
| + rm -rf ${srcdir}
Space paranoia.
| +}
| +sigfile() {
| + if [ \( "${SIG}" \) -a \( -e $name \) -a \( \( ! -e $name.sig \) -o
\( $name -nt $name.sig \) \) ]; then \
| + if [ -x /usr/bin/gpg ]; then \
| + echo "$text signature need to be updated"; \
| + /usr/bin/gpg --detach-sign $name; \
| + else \
| + echo "You need the gnupg package installed in order to make
signatures."; \
| + fi; \
| + fi;
| +}
| +checksig() {
| + if [ -x /usr/bin/gpg ]; then \
| + if [ -e $0.sig ]; then \
| + echo "SCRIPT signature follows:"; \
| + /usr/bin/gpg --verify $0.sig $0; \
| + else \
| + echo "SCRIPT signature missing."; \
| + fi; \
| + if [ -e ${src_orig_pkg}.sig ]; then \
| + echo "ORIGINAL PACKAGE signature follows:"; \
| + /usr/bin/gpg --verify ${src_orig_pkg}.sig ${src_orig_pkg}; \
| + else \
| + echo "ORIGINAL PACKAGE signature missing."; \
| + fi; \
| + if [ -e ${src_patch}.sig ]; then \
| + echo "PATCH signature follows:"; \
| + /usr/bin/gpg --verify ${src_patch}.sig ${src_patch}; \
| + else \
| + echo "PATCH signature missing."; \
| + fi; \
| + else
| + echo "You need the gnupg package installed in order to check
signatures."; \
| + fi;
Actual functions that check and/or update a specific file signature.
| }
| case $1 in
| - prep) prep ; STATUS=$? ;;
| + prep) prep ; STATUS=$? ;;
| mkdirs) mkdirs; STATUS=$? ;;
| - conf) conf ; STATUS=$? ;;
| + conf) conf ; STATUS=$? ;;
| build) build ; STATUS=$? ;;
| check) check ; STATUS=$? ;;
| clean) clean ; STATUS=$? ;;
| install) install ; STATUS=$? ;;
| strip) strip ; STATUS=$? ;;
| package) pkg ; STATUS=$? ;;
| - pkg) pkg ; STATUS=$? ;;
| + pkg) pkg ; STATUS=$? ;;
| mkpatch) mkpatch ; STATUS=$? ;;
Another form of "white-space paranoia": tab paranoia ^_^
| - src-package) spkg ; STATUS=$? ;;
| - spkg) spkg ; STATUS=$? ;;
| - finish) finish ; STATUS=$? ;;
| - all) prep && conf && build && install && \
| - strip && pkg && spkg && finish ; \
| - STATUS=$? ;;
| + src-package) name=$0 text="SCRIPT" sigfile; spkg ; STATUS=$? ;;
| + spkg) name=$0 text="SCRIPT" sigfile; spkg ; STATUS=$? ;;
| + finish) finish ; STATUS=$? ;;
| + checksig) checksig ; STATUS=$? ;;
| + all) prep && conf && build && install && \
| + strip && pkg && spkg && finish ; \
| + STATUS=$? ;;
| *) echo "Error: bad arguments" ; exit 1 ;;
| esac
| exit ${STATUS}
Final part of "signature patch".
Any comment?
BTW: does explicit "host and" "target" have a real usefullness? I have
found at least a package (which uses a *fairly old* autoconf and
automake) that breaks using it: it tries to use i686-pc-cygwin-gcc
instead of gcc and then says "compiler not supported".
I guess that anyhow packages are meant to be created from cygwin, so
host and target would be the default...
(ok ok, I guess someone of you out there has got a Linux or a FreeBSD
used to cross-compile packages...)
C ya,
~ Lapo
- --
Lapo 'Raist' Luchini
lapo@lapo.it (PGP & X.509 keys available)
http://www.lapo.it (ICQ UIN: 529796)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAj7/ducACgkQaJiCLMjyUvviCgCg+mPKMCrz6y1rCdrE3oIhNjjH
iB4AmgL24B/X8Gp/itnwXKyghzkm+LTG
=k5EY
-----END PGP SIGNATURE-----
--- templates/generic-build-script 2003-06-13 21:46:59.000000000 +0200
+++ generic.sh 2003-06-29 23:05:58.000000000 +0200
@@ -3,8 +3,8 @@
tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
test "x$tdir" = "x$0" && tdir=.
scriptdir=`cd $tdir; pwd`
-# find src directory.
-# If scriptdir ends in SPECS, then topdir is $scriptdir/..
+# find src directory.
+# If scriptdir ends in SPECS, then topdir is $scriptdir/..
# If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
# Otherwise, we assume that topdir = scriptdir
topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
@@ -26,15 +26,25 @@
export FULLPKG=${PKG}-${VER}-${REL}
# determine correct decompression option and tarball filename
-if [ -e ${PKG}-${VER}.tar.gz ] ; then
- export opt_decomp=z
- export src_orig_pkg_ext=gz
-elif [ -e ${PKG}-${VER}.tar.bz2 ] ; then
+export BASEPKG=${PKG}-${VER}
+if [ -e ${BASEPKG}.tar.bz2 ] ; then
export opt_decomp=j
- export src_orig_pkg_ext=bz2
+ export src_orig_pkg_name=${BASEPKG}.tar.bz2
+elif [ -e ${BASEPKG}.tar.gz ] ; then
+ export opt_decomp=z
+ export src_orig_pkg_name=${BASEPKG}.tar.gz
+elif [ -e ${BASEPKG}.tgz ] ; then
+ export opt_decomp=z
+ export src_orig_pkg_name=${BASEPKG}.tgz
+elif [ -e ${BASEPKG}.tar ] ; then
+ export opt_decomp=
+ export src_orig_pkg_name=${BASEPKG}.tar
+else
+ echo Cannot find original package.
+ exit 1
fi
-export src_orig_pkg_name=${PKG}-${VER}.tar.${src_orig_pkg_ext}
+# determine correct names for generated files
export src_pkg_name=${FULLPKG}-src.tar.bz2
export src_patch_name=${FULLPKG}.patch
export bin_pkg_name=${FULLPKG}.tar.bz2
@@ -68,7 +78,7 @@
(cd ${topdir} && \
tar xv${opt_decomp}f ${src_orig_pkg} ; \
cd ${topdir} && \
- patch -p0 < ${src_patch}
+ patch -p0 < ${src_patch}
&& mkdirs )
}
conf() {
@@ -79,8 +89,7 @@
--exec-prefix=${prefix} --sysconfdir=${sysconfdir} \
--libdir=${prefix}/lib --includedir=${prefix}/include \
--libexecdir='${sbindir}' --localstatedir=/var \
- --datadir='${prefix}/share'
-)
+ --datadir='${prefix}/share' )
}
build() {
(cd ${objdir} && \
@@ -96,7 +105,7 @@
}
install() {
(cd ${objdir} && \
- make install DESTDIR=${instdir}
+ make install DESTDIR=${instdir}
if [ -f ${instdir}${prefix}/info/dir ] ; then \
rm ${instdir}${prefix}/info/dir ; \
fi && \
@@ -106,9 +115,6 @@
if [ ! -d ${instdir}${prefix}/doc/Cygwin ]; then \
mkdir -p ${instdir}${prefix}/doc/Cygwin ; \
fi && \
- if [ ! -d ${instdir}${sysconfdir}/postinstall ]; then \
- mkdir -p ${instdir}${sysconfdir}/postinstall ; \
- fi && \
templist=""; \
for f in ${srcdir}/ANNOUNCE ${srcdir}/CHANGES ${srcdir}/INSTALL \
${srcdir}/KNOWNBUG ${srcdir}/LICENSE ${srcdir}/README \
@@ -131,14 +137,16 @@
fi ;\
fi ;\
if [ -f ${srcdir}/CYGWIN-PATCHES/postinstall.sh ] ; then \
- /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/postinstall.sh \
+ if [ ! -d ${instdir}${sysconfdir}/postinstall ]; then \
+ mkdir -p ${instdir}${sysconfdir}/postinstall ; \
+ fi && \
+ /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/postinstall.sh \
${instdir}${sysconfdir}/postinstall/${PKG}.sh
fi )
}
strip() {
(cd ${instdir} && \
- find . -name "*.dll" | xargs strip > /dev/null 2>&1
- find . -name "*.exe" | xargs strip > /dev/null 2>&1
+ find . -name "*.dll" -or -name "*.exe" | xargs strip > /dev/null 2>&1
true )
}
pkg() {
@@ -157,32 +165,70 @@
}
spkg() {
(mkpatch && \
+ if [ "${SIG}" ]; then name=${srcinstdir}/${src_patch_name} text="PATCH" sigfile; fi && \
cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
+ if [ -e ${src_orig_pkg}.sig ]; then cp ${src_orig_pkg}.sig ${srcinstdir}/; fi && \
cp $0 ${srcinstdir}/`basename $0` && \
+ if [ \( "${SIG}" \) -a \( -e $0.sig \) ]; then cp $0.sig ${srcinstdir}/; fi && \
cd ${srcinstdir} && \
tar cvjf ${src_pkg} * )
}
finish() {
- rm -rf ${srcdir}
+ rm -rf ${srcdir}
+}
+sigfile() {
+ if [ \( "${SIG}" \) -a \( -e $name \) -a \( \( ! -e $name.sig \) -o \( $name -nt $name.sig \) \) ]; then \
+ if [ -x /usr/bin/gpg ]; then \
+ echo "$text signature need to be updated"; \
+ /usr/bin/gpg --detach-sign $name; \
+ else \
+ echo "You need the gnupg package installed in order to make signatures."; \
+ fi; \
+ fi;
+}
+checksig() {
+ if [ -x /usr/bin/gpg ]; then \
+ if [ -e $0.sig ]; then \
+ echo "SCRIPT signature follows:"; \
+ /usr/bin/gpg --verify $0.sig $0; \
+ else \
+ echo "SCRIPT signature missing."; \
+ fi; \
+ if [ -e ${src_orig_pkg}.sig ]; then \
+ echo "ORIGINAL PACKAGE signature follows:"; \
+ /usr/bin/gpg --verify ${src_orig_pkg}.sig ${src_orig_pkg}; \
+ else \
+ echo "ORIGINAL PACKAGE signature missing."; \
+ fi; \
+ if [ -e ${src_patch}.sig ]; then \
+ echo "PATCH signature follows:"; \
+ /usr/bin/gpg --verify ${src_patch}.sig ${src_patch}; \
+ else \
+ echo "PATCH signature missing."; \
+ fi; \
+ else
+ echo "You need the gnupg package installed in order to check signatures."; \
+ fi;
}
case $1 in
- prep) prep ; STATUS=$? ;;
+ prep) prep ; STATUS=$? ;;
mkdirs) mkdirs; STATUS=$? ;;
- conf) conf ; STATUS=$? ;;
+ conf) conf ; STATUS=$? ;;
build) build ; STATUS=$? ;;
check) check ; STATUS=$? ;;
clean) clean ; STATUS=$? ;;
install) install ; STATUS=$? ;;
strip) strip ; STATUS=$? ;;
package) pkg ; STATUS=$? ;;
- pkg) pkg ; STATUS=$? ;;
+ pkg) pkg ; STATUS=$? ;;
mkpatch) mkpatch ; STATUS=$? ;;
- src-package) spkg ; STATUS=$? ;;
- spkg) spkg ; STATUS=$? ;;
- finish) finish ; STATUS=$? ;;
- all) prep && conf && build && install && \
- strip && pkg && spkg && finish ; \
- STATUS=$? ;;
+ src-package) name=$0 text="SCRIPT" sigfile; spkg ; STATUS=$? ;;
+ spkg) name=$0 text="SCRIPT" sigfile; spkg ; STATUS=$? ;;
+ finish) finish ; STATUS=$? ;;
+ checksig) checksig ; STATUS=$? ;;
+ all) prep && conf && build && install && \
+ strip && pkg && spkg && finish ; \
+ STATUS=$? ;;
*) echo "Error: bad arguments" ; exit 1 ;;
esac
exit ${STATUS}