File debian.rules of Package ucspi-tcp
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This is the debhelper compatibility version to use.
export DH_COMPAT=5
CFLAGS = -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
NAME=ucspi-tcp
#DESTDIR=/usr/src/packages/BUILD/debian/$(NAME)
DESTDIR=debian/$(NAME)
PREFIX=/usr
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/share/man
DOCDIR=$(PREFIX)/share/doc/$(NAME)
build: build-stamp
build-stamp:
dh_testdir
# Add here commands to compile the package.
patch <../SOURCES/ucspi-tcp-0.88.errno.patch -p 0 --fuzz=0 -s
patch <../SOURCES/ucspi-tcp-0.88.a+_record.patch -p 0 --fuzz=0 -s
patch <../SOURCES/ucspi-tcp-0.88.limits.patch -p 0 --fuzz=0 -s
patch <../SOURCES/ucspi-tcp-0.88.rbltimeout.patch -p 0 --fuzz=0 -s
patch <../SOURCES/ucspi-tcp-0.88.nodefaultrbl.patch -p 1 --fuzz=0 -s
patch <../SOURCES/fix_includes_prototypes.patch -p 0 --fuzz=0 -s
patch <../SOURCES/ucspi-tcp-no-return.patch -p 0 --fuzz=0 -s
patch <../SOURCES/ucspi-tcp-0.88-ipv6.patch -p 1 --fuzz=0 -s
tar xfj ../SOURCES/ucspi-tcp-0.88-man.tar.bz2
patch -p1 <../SOURCES/ucspi-tcp-0.88-ipv6-man.patch --fuzz=0 -s
grep -v '\*path' pathexec_env.c >tmp && mv tmp pathexec_env.c
sed -i 's=short=gid_t=' chkshsgr.c
sed -i 's=gid(int=gid(gid_t=' prot.c prot.h
sed -i 's=^main=int main=' *.c
sed -i 's=_pid(=_pid(int *, int=;s=_nohang(=_nohang(int *=' wait.h
echo 'extern int socket_tcpnodelay(int s);' >>socket.h
echo 'extern int socket_ipoptionskill(int s);' >>socket.h
echo "#include <string.h>" >byte.h.new
echo "static inline unsigned int byte_chr(void *s, size_t n, int c) {" >>byte.h.new
echo "void *result = memchr(s, c, n);" >>byte.h.new
echo "if (!result) { return n; }" >>byte.h.new
echo "return result - s;" >>byte.h.new
echo "}" >>byte.h.new
echo "static inline unsigned int byte_rchr(void *s, size_t n, int c) {" >>byte.h.new
echo "void *result = memrchr(s, c, n);" >>byte.h.new
echo "if (!result) { return n; }" >>byte.h.new
echo "return result - s;" >>byte.h.new
echo "}" >>byte.h.new
echo "#define byte_copy(to,n,from) memcpy(to,from,n)" >>byte.h.new
echo "#define byte_copyr(to,n,from) memmove(to,from,n)" >>byte.h.new
echo "#define byte_diff(s,n,t) memcmp(s,t,n)" >>byte.h.new
echo "#define byte_zero(s,n) memset(s,0,n)" >>byte.h.new
echo "`grep byte_equal byte.h`" >>byte.h.new
mv byte.h.new byte.h
echo >byte_chr.c
echo >byte_copy.c
echo >byte_cr.c
echo >byte_diff.c
echo >byte_rchr.c
echo >byte_zero.c
echo "#include <stdlib.h>" >alloc.h
echo "#define alloc(n) malloc(n)" >>alloc.h
echo "#define alloc_free(x) free(x)" >>alloc.h
echo "static inline int alloc_re(char **x, unsigned int m, unsigned int n) {" >>alloc.h
echo "void *y = realloc((void*) *x, n);" >>alloc.h
echo "if (!y) return 0;" >>alloc.h
echo "*x = (char*) y;" >>alloc.h
echo "return 1;" >>alloc.h
echo "}" >>alloc.h
echo >alloc.c
echo >alloc_re.c
echo 'cc $(CFLAGS) -D_GNU_SOURCE -include scan.h -include unistd.h' > conf-cc
echo 'cc $(CFLAGS)' > conf-ld
echo $(PREFIX) > conf-home
make prog
# --- end custom part for compiling
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process.
rm -rf $(DESTDIR)
rm -f `cat TARGETS`
# --- end custom part for cleaning up
dh_clean
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
# Add here commands to install the package
# The DESTDIR Has To Be Exactly /usr/src/packages/BUILD/debian/<nameOfPackage>
mkdir -p "$(DESTDIR)$(BINDIR)"
grep ' c(.*[0-9]);' hier.c \
| sed 's=^[^"]*"==;s=","= =;s="[^0]*= =;s=[^0-9]*$$==' \
| while read dest file mode; do \
install -m "$$mode" "$$file" "$(DESTDIR)$(BINDIR)/"; \
done
for i in 5 8; do \
mkdir -p "$(DESTDIR)$(MANDIR)/man$$i"; \
for j in ucspi-tcp-0.88-man/*$$i; do \
install -m 0644 $$j "$(DESTDIR)$(MANDIR)/man$$i"; \
done \
done
ln ucspi-tcp-0.88-man/README README.man
# --- end custom part for installing
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
# dh_installdebconf
dh_installdocs CHANGES README* TODO VERSION
dh_installexamples
dh_installmenu
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_installinit
dh_installcron
dh_installman
dh_installinfo
# dh_undocumented
dh_installchangelogs
dh_link
dh_strip --dbg-package=ucspi-tcp-dbg
dh_compress
dh_fixperms
# dh_makeshlibs
dh_installdeb
# dh_perl
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install