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
|
#!/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
PKG = systemimager
VERSION = $(shell dpkg-parsechangelog | grep ^Version: | \
cut -d " " -f 2 | cut -d "-" -f 1)
BUILD_DIR = $(PKG)-$(VERSION)
UPSTREAM_TARBALL = $(PKG)-$(VERSION).tar.bz2
ARCH = $(shell dpkg --print-architecture)
BOOTPKG = $(PKG)-boot-$(ARCH)-standard
PATCHES=$(sort $(shell find $(CURDIR)/patches -name "*.patch"))
configure: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
@echo -n "Extracting upstream tarball..."
@tar xfj $(UPSTREAM_TARBALL)
@echo "done."
@cd $(BUILD_DIR) && \
$(foreach patch, $(PATCHES), \
echo -n Applying `basename $(patch)`... && cat $(patch) | \
patch -s -p1 && echo done. &&) /bin/true
touch configure-stamp
copy_changelog: $(BUILD_DIR)/changelog
$(BUILD_DIR)/changelog: $(BUILD_DIR)/CHANGE.LOG
cd $(BUILD_DIR) && cp CHANGE.LOG changelog
build: build-arch build-indep
build-indep: cleandeb configure-stamp build-indep-stamp copy_changelog
build-indep-stamp:
# the pdf build reports a failure, but the result looks fine...
-$(MAKE) -C $(BUILD_DIR) docs USE_SGMLTOOLS=1
touch build-indep-stamp
build-arch: cleandeb configure-stamp build-arch-stamp copy_changelog
build-arch-stamp:
dh_testdir
$(MAKE) -C $(BUILD_DIR) binaries MKCRAMFS=/usr/sbin/mkcramfs
touch build-arch-stamp
test: build-arch-stamp
## make sure we haven't blown the floppy size
## (we only support floppies on x86)
ifeq ($(ARCH),i386)
$(MAKE) -C $(BUILD_DIR) check_floppy_size
endif
## make sure parted doesn't segfault
mkdir mnt
mkdir testroot
sudo mount $(BUILD_DIR)/initrd_source/initrd mnt -t cramfs -o loop
sudo rsync -av mnt/* testroot/
sudo umount mnt
rmdir mnt
cd testroot && sudo tar xvfz ../$(BUILD_DIR)/tmp/boel_binaries.tar.gz
sudo chroot testroot /sbin/parted --version
sudo rm -rf testroot
cleandeb:
# generate control file suitable for the boot package
# substvars don't seem to work, so we hack around it with sed.
cp debian/control debian/control.orig
sed -e 's/$${misc\:Package\-Arch}/$(ARCH)/g' \
-e 's/$${misc\:Real\-Arch}/all/;' \
debian/control.in > debian/control
clean: cleandeb
dh_testdir
dh_testroot
rm -f build-indep-stamp build-arch-stamp configure-stamp
# Add here commands to clean up after the build process.
rm -rf $(BUILD_DIR)
cd $(CURDIR)/debian && rm -rf $(PKG)-client $(PKG)-server \
$(PKG)-common $(PKG)-doc $(BOOTPKG) $(PKG)-boot \
$(PKG)-server-flamethrowerd
rm -f debian/$(PKG)-server.init
rm -f debian/$(PKG)-server-flamethrowerd.init
dh_clean
install-arch: build-arch
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
cd $(CURDIR)/debian && mkdir -p $(BOOTPKG)
# Add here commands to install the packages
$(MAKE) -C $(BUILD_DIR) install_binaries \
DESTDIR=$(CURDIR)/debian/$(BOOTPKG) PREFIX=/usr
install-indep: build-indep
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
cd $(CURDIR)/debian && mkdir -p $(PKG)-client \
$(PKG)-server $(PKG)-common $(PKG)-doc
# Add here commands to install the packages
$(MAKE) -C $(BUILD_DIR) install_client \
DESTDIR=$(CURDIR)/debian/$(PKG)-client PREFIX=/usr
$(MAKE) -C $(BUILD_DIR) install_server \
DESTDIR=$(CURDIR)/debian/$(PKG)-server PREFIX=/usr
# these are installed properly by dh_installinit later
rm -rf $(CURDIR)/debian/$(PKG)-server/etc/init.d
$(MAKE) -C $(BUILD_DIR) install_common \
DESTDIR=$(CURDIR)/debian/$(PKG)-common PREFIX=/usr
# the pdf build reports a failure, but the result looks fine...
-$(MAKE) -C $(BUILD_DIR) install_docs \
DESTDIR=$(CURDIR)/debian/$(PKG)-doc PREFIX=/usr USE_SGMLTOOLS=1
mkdir -p $(CURDIR)/debian/$(PKG)-server-flamethrowerd/etc/systemimager
mv $(CURDIR)/debian/$(PKG)-server/etc/systemimager/flamethrower.conf \
$(CURDIR)/debian/$(PKG)-server-flamethrowerd/etc/systemimager/
# Build architecture-dependent files here.
binary-arch: build-arch install-arch
dh_testdir -p$(BOOTPKG)
dh_testroot -p$(BOOTPKG)
dh_installdocs -p$(BOOTPKG)
dh_installchangelogs -p$(BOOTPKG)
dh_link -p$(BOOTPKG)
dh_strip -p$(BOOTPKG)
dh_compress -p$(BOOTPKG)
dh_fixperms -p$(BOOTPKG)
dh_installdeb -p$(BOOTPKG)
dh_perl -p$(BOOTPKG)
dh_shlibdeps -p$(BOOTPKG)
dh_gencontrol -p$(BOOTPKG)
dh_md5sums -p$(BOOTPKG)
dh_builddeb -p$(BOOTPKG)
# Build architecture-independent files here.
binary-indep: build-indep install-indep
dh_testdir -N$(BOOTPKG)
dh_testroot -N$(BOOTPKG)
# dh_installdebconf
dh_installdocs -N$(BOOTPKG)
dh_installexamples -p$(PKG)-server $(BUILD_DIR)/doc/local.cfg
cp ./$(PKG)-$(VERSION)/etc/init.d/$(PKG)-server-rsyncd \
./debian/$(PKG)-server.init
dh_installinit -p$(PKG)-server --init-script=$(PKG)-server
cp ./$(PKG)-$(VERSION)/etc/init.d/$(PKG)-server-netbootmond \
./debian/$(PKG)-server.init
dh_installinit -p$(PKG)-server --init-script=netbootmond
cp ./$(PKG)-$(VERSION)/etc/init.d/$(PKG)-server-flamethrowerd \
./debian/$(PKG)-server-flamethrowerd.init
dh_installinit -p$(PKG)-server-flamethrowerd \
--init-script=systemimager-server-flamethrowerd
dh_installchangelogs -N$(BOOTPKG)
dh_link -N$(BOOTPKG)
dh_strip -N$(BOOTPKG)
dh_compress -N$(BOOTPKG)
dh_fixperms -N$(BOOTPKG)
dh_installdeb -N$(BOOTPKG)
dh_perl -N$(BOOTPKG)
dh_shlibdeps -N$(BOOTPKG)
dh_gencontrol -N$(BOOTPKG)
dh_md5sums -N$(BOOTPKG)
dh_builddeb -N$(BOOTPKG)
binary: binary-indep binary-arch
.PHONY: build cleandeb clean binary-indep binary-arch binary install configure
|