#!/bin/sh
#
# debian.sh - Debian package builder
# @configure_input@
#
# Copyright (C) 2002 Stefan Jahn <stefan@lkcc.org>
#
# This is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
version=@VERSION@
source=@PACKAGE@-@VERSION@.tar.gz
topdir=debian
builddir=build
controlfile=$topdir/control
copyrightfile=$topdir/copyright
changelogfile=$topdir/changelog
changelogscript=$topdir/build/debian-changelog.awk
rulesfile=$topdir/rules
# Step 1 - Create directory structure
test -d $topdir || mkdir -p $topdir || exit 1
test -d $topdir/$builddir || mkdir -p $topdir/$builddir || exit 1
cp -p $source $topdir/$builddir
# Step 2 - Create `control' file
cat <<EOF > $controlfile
Source: serveez
Section: net
Priority: optional
Maintainer: Stefan Jahn <stefan@lkcc.org>
Standards-Version: 3.2.1
Package: serveez
Architecture: any
Depends: ${shlibs:Depends}
Description: A server framework.
Serveez is a server framework. It provides routines and help for
implementing IP based servers (currently TCP, UDP and ICMP). It is also
possible to use named pipes for all connection oriented protocols.
.
We think it is worth the effort because many people need server functionality
within their applications. However, many people experience problems
with select()- or poll()-loops, and with non-blocking operations.
.
This application demonstrates various aspects of advanced network
programming in a portable manner. It is known to compile and run on
GNU/Linux systems, as well as on other 32-bit and 64-bit flavours of Unix
and on Microsoft Windows (9x/ME/NT/2000/XP).
.
You can use it for implementing your own servers or for understanding how
certain network services and operations work.
.
The package includes a number of servers that work already: an HTTP server,
an IRC server, a Gnutella spider and some others. One of the highlights is
that you can run all protocols on the same port. The application itself is
single threaded but it uses helper processes for concurrent name resolution
and ident lookups.
EOF
# Step 3 - Create `copyright' file
cat <<EOF > $copyrightfile
This package was debianized by Stefan Jahn <stefan@lkcc.org> on
@TIMESTAMP@.
It was downloaded from <http://ftp.gnu.org/gnu/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz>.
Copyright (C) 2000, 2001, 2002 Stefan Jahn <stefan@lkcc.org>
Copyright (C) 2000, 2001, 2002 Raimund Jacob <raimi@lkcc.org>
Copyright (C) 1999, 2000, 2001, 2002 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
This is free software; the Free Software Foundation
gives unlimited permission to copy and/or distribute it,
with or without modifications, as long as this notice is preserved.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY, to the extent permitted by law; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
EOF
# Step 4 - Create `changelog' file (generated: NEWS)
cat <<\EOF > $changelogscript
/^Version/ {
version = $2
gsub(/[^0-9\.]/, "", version)
if (version != "") {
print "serveez (" version ") unstable; urgency=low\n"
getline line
getline line
if (getline <= 0) { exit 0 }
line = $0
while(line != "") {
print " " line
if (getline <= 0) { exit 0 }
line = $0
}
print "\n -- Stefan Jahn <stefan@lkcc.org> @TIMESTAMP_RFC822@\n"
}
}
EOF
@AWK@ -f $changelogscript < NEWS > $changelogfile
# Step 5 - Create `rules' file
cat <<\EOF > $rulesfile
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
# This is the debhelper compatibility version to use.
export DH_COMPAT=1
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
build: build-stamp
dh_testdir
test -d debian/build/@PACKAGE@-@VERSION@ || \
(cd debian/build && tar xvzf @PACKAGE@-@VERSION@.tar.gz)
test -f debian/build/@PACKAGE@-@VERSION@/config.h || \
(cd debian/build/@PACKAGE@-@VERSION@ && \
./configure --enable-opt --prefix=/usr \
--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE))
test -f debian/build/@PACKAGE@-@VERSION@/src/serveez || \
(cd debian/build/@PACKAGE@-@VERSION@ && $(MAKE) all)
build-stamp:
touch build-stamp
check: build
dh_testdir
test ! -f debian/build/@PACKAGE@-@VERSION@/Makefile || \
(cd debian/build/@PACKAGE@-@VERSION@ && $(MAKE) check)
clean:
dh_testdir
dh_testroot
rm -f build-stamp
test ! -f debian/build/@PACKAGE@-@VERSION@/Makefile || \
(cd debian/build/@PACKAGE@-@VERSION@ && $(MAKE) clean)
dh_clean
install: build-stamp
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
(cd debian/build/@PACKAGE@-@VERSION@ && \
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp)
# Build architecture-independent files here.
binary-indep: build install
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installdocs
dh_installexamples
dh_installmenu
dh_installinit
dh_installcron
dh_installmanpages
dh_installinfo
dh_installchangelogs
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
EOF
# Step 6 - Create other optional files
# Menu entry
cat <<EOF > $topdir/menu
?package(serveez):\
needs=text\
section=Apps/Net\
title="Serveez"\
command="/usr/bin/serveez"
EOF
# Step 7 - Run debian commands to build the Debian package
chmod +x $rulesfile
dpkg-buildpackage -rfakeroot -d -b -nc
# Step 8 - Cleanup
mv -f ../*.deb ../*.changes .
rm -rf $topdir
rm build-stamp
syntax highlighted by Code2HTML, v. 0.9.1