1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
#!/usr/bin/make -f
# -*- makefile -*-
# 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
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
include /usr/share/dpatch/dpatch.make
# (Most of) the files this concerns belong to /usr/lib/util-vserver.
# To keep referencing simple, and because we're not even sure there
# are files belonging to /var/lib/util-vserver, we stay with the default
# so far.
#MAKE_OPTS = pkglibdir=/var/lib/util-vserver PKGLIBDIR=/var/lib/util-vserver
CFLAGS = -Wall -g
# Some checks to avoid building on some arches as there is no reserved syscalls
# for the Linux kernel on this arch.
ifeq ($(DEB_HOST_ARCH),arm)
do_not_buid_this_arch
endif
#ifeq ($(DEB_HOST_ARCH),powerpc)
# # dietlibc's sys/types.h tests for "powerpc", not "__powerpc__"
# CFLAGS += -Dpowerpc
#endif
# Commented out as it do no longer build with this...
ifeq ($(DEB_HOST_ARCH),sparc)
# Targetting at older sparc's causes compilation errors. Steve Langasek
# says this works and it is anyway the oldest sparc generation we
# support in Debian (or kernel/glibc).
CFLAGS += -mcpu=v8
endif
ifeq ($(DEB_HOST_ARCH),hppa)
# dietlibc fails to define O_NOFOLLOW and O_LARGEFILE. These values
# have been copied from glibc's bits/fcntl.h.
# CFLAGS += -DO_NOFOLLOW=00000200 -DO_LARGEFILE=00004000
# do_not_buid_this_arch
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
# Fix to make it build on hppa, mipsel and s390
# If this is not fixed, gcc is invoked as a cross compiler.
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
confflags += --build $(DEB_HOST_GNU_TYPE)
else
confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif
config.status: configure
dh_testdir
# $(MAKE) -f Makefile.svn
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
if [ -f config.sub ];then mv config.sub config.sub.orig;fi
ln -s /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
if [ -f config.guess ];then mv config.guess config.guess.orig;fi
ln -s /usr/share/misc/config.guess config.guess
endif
# Add here commands to configure the package.
CFLAGS="$(CFLAGS)" ./configure $(confflags) \
--prefix=/usr --enable-release \
--mandir=\$${prefix}/share/man \
--infodir=\$${prefix}/share/info \
--sysconfdir=/etc --enable-dietlibc \
--localstatedir=/var \
--enable-apis=NOLEGACY \
--with-vrootdir=/var/lib/vservers
build: patch build-stamp
build-stamp: config.status
dh_testdir
# Add here commands to compile the package.
$(MAKE) $(MAKE_OPTS) all
$(MAKE) -C man
touch build-stamp
clean: unpatch
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process.
-$(MAKE) clean
-$(MAKE) distclean
rm -f config.status config.log config.sub config.guess
if [ -f config.sub.orig ];then \
rm -f config.sub; \
mv config.sub.orig config.sub; \
fi
if [ -f config.guess.orig ];then \
rm -f config.guess; \
mv config.guess.orig config.guess; \
fi
# clean up leftover files...
rm -rf tests/.libs vserver-start/.libs
debconf-updatepo
dh_clean
install: patch build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/util-vserver.
$(MAKE) $(MAKE_OPTS) DESTDIR=$(CURDIR)/debian/util-vserver install install-distribution
# Fixes
chmod +x $(CURDIR)/debian/util-vserver/usr/lib/util-vserver/distributions/template/initpre
chmod +x $(CURDIR)/debian/util-vserver/usr/lib/util-vserver/distributions/template/initpost
rm -f $(CURDIR)/debian/util-vserver/usr/lib/*.la
rm -f $(CURDIR)/debian/util-vserver/etc/init.d/vservers-legacy
rm -f $(CURDIR)/debian/util-vserver/etc/init.d/vservers-default
rm -f $(CURDIR)/debian/util-vserver/etc/init.d/rebootmgr
rm -f $(CURDIR)/debian/util-vserver/etc/init.d/vprocunhide
# have to remove v_ init scripts
rm -f $(CURDIR)/debian/util-vserver/etc/init.d/v_*
# remove newvserver.defaults (because that is linuxconf and that is not supported in debian).
#rm -f $(CURDIR)/debian/util-vserver/etc/vservers/newvserver.defaults
# # Move util-vserver-vars to /etc/vservers as it is needed for legacy support
# grep -v "Id: util-vserver-vars.pathsubst,v" \
# $(CURDIR)/debian/util-vserver/usr/lib/util-vserver/util-vserver-vars \
# > $(CURDIR)/debian/util-vserver/etc/vservers/util-vserver-vars
# rm -f $(CURDIR)/debian/util-vserver/usr/lib/util-vserver/util-vserver-vars
# ln -s /etc/vservers/util-vserver-vars $(CURDIR)/debian/util-vserver/usr/lib/util-vserver/util-vserver-vars
# Fix for symlinks in /etc/vservers/.defaults
rm -f $(CURDIR)/debian/util-vserver/etc/vservers/.defaults/vdirbase
rm -f $(CURDIR)/debian/util-vserver/etc/vservers/.defaults/run.rev
# Rewrite util-vserver-vars
perl -pi -e \
's|^(.*DEFAULT_VSERVERDIR=).*$$|$$1"/etc/vservers/.defaults/vdirbase"|;' \
debian/util-vserver/usr/lib/util-vserver/util-vserver-vars
# Remove development files as they are not supported upstream in a
# proper way.
# rm -rf $(CURDIR)/debian/util-vserver/usr/include/
# rm -f $(CURDIR)/debian/util-vserver/usr/lib/*.so*
# rm -f $(CURDIR)/debian/util-vserver/usr/lib/*.a
# rm -rf $(CURDIR)/debian/util-vserver/usr/lib/pkgconfig
mkdir -p $(CURDIR)/debian/util-vserver/etc/bash_completion.d
cp $(CURDIR)/debian/vserver.bash_completion $(CURDIR)/debian/util-vserver/etc/bash_completion.d/vserver
# Lintian overrides
mkdir -p $(CURDIR)/debian/util-vserver/usr/share/lintian/overrides
install -m644 debian/util-vserver.override $(CURDIR)/debian/util-vserver/usr/share/lintian/overrides/util-vserver
# 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_installchangelogs ChangeLog
dh_installdocs
dh_installexamples
dh_installdebconf
dh_installinit
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
dh_makeshlibs
dh_installdeb
dh_shlibdeps -L util-vserver -l debian/util-vserver/usr/lib
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
|