File Annotation
Not logged in
adaa8411d9 2008-04-25   stephan: #!/bin/bash
adaa8411d9 2008-04-25   stephan: # A quick hack to generate a Debian package of fossil. i took most of this
adaa8411d9 2008-04-25   stephan: # from Martin Krafft's "The Debian System" book.
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: DEB_REV=${1-1} # .deb package build/revision number.
adaa8411d9 2008-04-25   stephan: PACKAGE_DEBNAME=fossil-scm
adaa8411d9 2008-04-25   stephan: THISDIR=${PWD}
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: if uname -a | grep -i nexenta &>/dev/null; then
adaa8411d9 2008-04-25   stephan: # Assume NexentaOS/GnuSolaris:
adaa8411d9 2008-04-25   stephan:     DEB_PLATFORM=nexenta
adaa8411d9 2008-04-25   stephan:     DEB_ARCH_NAME=solaris-i386
adaa8411d9 2008-04-25   stephan:     DEB_ARCH_PKGDEPENDS="sunwcsl" # for -lsocket
adaa8411d9 2008-04-25   stephan: else
adaa8411d9 2008-04-25   stephan:     DEB_PLATFORM=${DEB_PLATFORM-ubuntu-feisty}
adaa8411d9 2008-04-25   stephan:     DEB_ARCH_NAME=i386
adaa8411d9 2008-04-25   stephan: fi
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: SRCDIR=$(cd ..; pwd)
adaa8411d9 2008-04-25   stephan: test -e ${SRCDIR}/fossil || {
adaa8411d9 2008-04-25   stephan:     echo "This script must be run from a BUILT copy of the source tree."
adaa8411d9 2008-04-25   stephan:     exit 1
adaa8411d9 2008-04-25   stephan: }
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: DEBROOT=$PWD/deb.tmp
adaa8411d9 2008-04-25   stephan: test -d ${DEBROOT} && rm -fr ${DEBROOT}
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: DEBLOCALPREFIX=${DEBROOT}/usr
adaa8411d9 2008-04-25   stephan: BINDIR=${DEBLOCALPREFIX}/bin
adaa8411d9 2008-04-25   stephan: mkdir -p ${BINDIR}
adaa8411d9 2008-04-25   stephan: mkdir -p ${DEBLOCALPREFIX}/share/doc/${PACKAGE_DEBNAME}
adaa8411d9 2008-04-25   stephan: cp ../fossil ${BINDIR}
adaa8411d9 2008-04-25   stephan: strip ${BINDIR}/fossil
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: cd $DEBROOT || {
adaa8411d9 2008-04-25   stephan:     echo "Debian dest dir [$DEBROOT] not found. :("
adaa8411d9 2008-04-25   stephan:     exit 2
adaa8411d9 2008-04-25   stephan: }
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: rm -fr DEBIAN
adaa8411d9 2008-04-25   stephan: mkdir DEBIAN
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: PACKAGE_VERSION=$(date +%Y.%m.%d)
adaa8411d9 2008-04-25   stephan: PACKAGE_DEB_VERSION=${PACKAGE_VERSION}-${DEB_REV}
adaa8411d9 2008-04-25   stephan: DEBFILE=${THISDIR}/${PACKAGE_DEBNAME}-${PACKAGE_DEB_VERSION}-dev-${DEB_ARCH_NAME}-${DEB_PLATFORM}.deb
adaa8411d9 2008-04-25   stephan: PACKAGE_TIME=$(/bin/date)
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: rm -f ${DEBFILE}
adaa8411d9 2008-04-25   stephan: echo "Creating .deb package [${DEBFILE}]..."
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: echo "Generating md5 sums..."
adaa8411d9 2008-04-25   stephan: find ${DEBLOCALPREFIX} -type f -exec md5sum {} \; > DEBIAN/md5sums
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: true && {
adaa8411d9 2008-04-25   stephan:     echo "Generating Debian-specific files..."
adaa8411d9 2008-04-25   stephan:     COPYRIGHT=${DEBLOCALPREFIX}/share/doc/${PACKAGE_DEBNAME}/copyright
adaa8411d9 2008-04-25   stephan:     cat <<EOF > ${COPYRIGHT}
adaa8411d9 2008-04-25   stephan: This package was created by stephan beal <stephan@s11n.net>
adaa8411d9 2008-04-25   stephan: on ${PACKAGE_TIME}.
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: The original sources for fossil can be downloaded for free from:
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: http://www.fossil-scm.org/
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: fossil is released under the terms of the GNU General Public License.
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: EOF
adaa8411d9 2008-04-25   stephan: }
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: true && {
adaa8411d9 2008-04-25   stephan:     CHANGELOG=${DEBLOCALPREFIX}/share/doc/${PACKAGE_DEBNAME}/changelog.gz
adaa8411d9 2008-04-25   stephan:     cat <<EOF | gzip -c > ${CHANGELOG}
adaa8411d9 2008-04-25   stephan: ${PACKAGE_DEBNAME} ${PACKAGE_DEB_VERSION}; urgency=low
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: This release has no changes over the core source distribution. It has
adaa8411d9 2008-04-25   stephan: simply been Debianized.
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: Packaged by stephan beal <stephan@s11n.net> on
adaa8411d9 2008-04-25   stephan: ${PACKAGE_TIME}.
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: EOF
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: }
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: true && {
adaa8411d9 2008-04-25   stephan:     CONTROL=DEBIAN/control
adaa8411d9 2008-04-25   stephan:     echo "Generating ${CONTROL}..."
adaa8411d9 2008-04-25   stephan:     cat <<EOF > ${CONTROL}
adaa8411d9 2008-04-25   stephan: Package: ${PACKAGE_DEBNAME}
adaa8411d9 2008-04-25   stephan: Section: devel
adaa8411d9 2008-04-25   stephan: Priority: optional
adaa8411d9 2008-04-25   stephan: Maintainer: stephan beal <stephan@s11n.net>
adaa8411d9 2008-04-25   stephan: Architecture: ${DEB_ARCH_NAME}
adaa8411d9 2008-04-25   stephan: Depends: libc6-dev ${DEB_ARCH_PKGDEPENDS+, }${DEB_ARCH_PKGDEPENDS}
adaa8411d9 2008-04-25   stephan: Version: ${PACKAGE_DEB_VERSION}
adaa8411d9 2008-04-25   stephan: Description: a powerful, flexible serialization framework for C++.
adaa8411d9 2008-04-25   stephan:  This package contains all files needed for development, as well as the s11nconvert tool
adaa8411d9 2008-04-25   stephan:  and library documentation. Note that an ODD minor version number (e.g. 1.1 or 1.3)
adaa8411d9 2008-04-25   stephan:  indicates a beta/development version, not intended for general client-side use,
adaa8411d9 2008-04-25   stephan:  whereas EVEN minor numbers (e.g. 1.2 or 1.4) indicate stable versions.
adaa8411d9 2008-04-25   stephan: EOF
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: }
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: true && {
adaa8411d9 2008-04-25   stephan: #    GZ_CONTROL=control.tar.gz
adaa8411d9 2008-04-25   stephan: #    GZ_DATA=data.tar.gz
adaa8411d9 2008-04-25   stephan: #    echo "Generating ${GZ_CONTROL} and ${GZ_DATA}..."
adaa8411d9 2008-04-25   stephan: #    rm -f ${GZ_CONTROL} ${GZ_DATA} ${DEBFILE} 2>/dev/null
adaa8411d9 2008-04-25   stephan: #    tar cz -C DEBIAN -f ${GZ_CONTROL} .
adaa8411d9 2008-04-25   stephan: #    tar czf ${GZ_DATA} --exclude='*/doxygen-*' usr
adaa8411d9 2008-04-25   stephan: #    echo '2.0' > debian-binary
adaa8411d9 2008-04-25   stephan:     #ar rcu ${DEBFILE} debian-binary ${GZ_CONTROL} ${GZ_DATA}
adaa8411d9 2008-04-25   stephan:     dpkg-deb -b ${DEBROOT} ${DEBFILE}
adaa8411d9 2008-04-25   stephan:     echo "Package file created:"
adaa8411d9 2008-04-25   stephan:     ls -la ${DEBFILE}
adaa8411d9 2008-04-25   stephan:     dpkg-deb --info ${DEBFILE}
adaa8411d9 2008-04-25   stephan: }
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: cd - >/dev/null
adaa8411d9 2008-04-25   stephan: true && {
adaa8411d9 2008-04-25   stephan:     echo "Cleaning up..."
adaa8411d9 2008-04-25   stephan:     rm -fr ${DEBROOT}
adaa8411d9 2008-04-25   stephan: }
adaa8411d9 2008-04-25   stephan: 
adaa8411d9 2008-04-25   stephan: echo "Done :)"