| 1 |
#!/usr/bin/make -f |
| 2 |
# -*- mode: makefile; coding: utf-8 -*- |
| 3 |
# Copyright © 2003 Jeff Bailey <[email protected]> |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU General Public License as |
| 7 |
# published by the Free Software Foundation; either version 2, or (at |
| 8 |
# your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
# General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 18 |
# 02111-1307 USA. |
| 19 |
|
| 20 |
include /usr/share/dpkg/architecture.mk |
| 21 |
include /usr/share/dpkg/buildtools.mk |
| 22 |
|
| 23 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie |
| 24 |
|
| 25 |
DEB_DESTDIR = $(CURDIR)/debian/tmp |
| 26 |
DEB_DESTDIR_UDEB = $(CURDIR)/debian/tmp-udeb |
| 27 |
DEB_DESTDIR_PROF = $(CURDIR)/debian/tmp-prof |
| 28 |
|
| 29 |
TRANSLATORS_PROF = auth exec ext2fs pci-arbiter pfinet lwip pflocal proc procfs term |
| 30 |
|
| 31 |
CONFIGURE_ARGS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
| 32 |
ifeq (,$(filter stage1 stage2,$(DEB_BUILD_PROFILES))) |
| 33 |
CONFIGURE_ARGS += --disable-profile --enable-static-progs='ext2fs,iso9660fs,rumpdisk,rumpusbdisk,rumpnet,pci-arbiter,acpi,startup,proc,auth,pfinet,pflocal' |
| 34 |
else |
| 35 |
CONFIGURE_ARGS += \ |
| 36 |
--disable-ncursesw \ |
| 37 |
--without-libbz2 \ |
| 38 |
--without-libz \ |
| 39 |
--without-parted \ |
| 40 |
--without-libcrypt \ |
| 41 |
--without-acpica \ |
| 42 |
--without-rump \ |
| 43 |
--without-libtirpc |
| 44 |
# Skip some checks because they expect |
| 45 |
# a working glibc causing a circular dependency. |
| 46 |
# TODO: rather disable the corresponding features in configure.ac |
| 47 |
export ac_cv_lib_pciaccess_pci_system_init=no |
| 48 |
ifneq (,$(filter stage1,$(DEB_BUILD_PROFILES))) |
| 49 |
export ac_cv_search_clnt_create=no |
| 50 |
export ac_cv_func_file_exec_paths=no |
| 51 |
export ac_cv_func_exec_exec_paths=no |
| 52 |
export ac_cv_func__hurd_exec_paths=no |
| 53 |
export ac_cv_func__hurd_libc_proc_init=no |
| 54 |
export ac_cv_func_file_utimens=no |
| 55 |
export ac_cv_func_mach_port_set_ktype=no |
| 56 |
export LEX=: |
| 57 |
export YACC=: |
| 58 |
export MIG=: |
| 59 |
endif |
| 60 |
endif |
| 61 |
CONFIGURE_ARGS += prefix=/usr libdir=/usr/lib/$(DEB_HOST_MULTIARCH) sysconfdir=/etc localstatedir=/var |
| 62 |
CONFIGURE_ARGS_deb = |
| 63 |
CONFIGURE_ARGS_udeb = libdir=/usr/lib --without-libdaemon --without-libbz2 |
| 64 |
SUID_PROGRAMS = /usr/bin/ids /usr/bin/login /usr/bin/ps-hurd /usr/bin/w-hurd /usr/sbin/smp |
| 65 |
|
| 66 |
INSTALL_in := $(wildcard debian/*.install.in) |
| 67 |
INSTALL_generated := $(patsubst %.in,%,$(INSTALL_in)) |
| 68 |
|
| 69 |
BUILT_USING := $(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libc0.3-dev libparted-dev zlib1g-dev libbz2-dev uuid-dev libblkid-dev) |
| 70 |
|
| 71 |
# for libdde-linux26 ARCH |
| 72 |
ifeq ($(DEB_HOST_ARCH_CPU),amd64) |
| 73 |
ARCH = amd64 |
| 74 |
else |
| 75 |
ARCH = x86 |
| 76 |
endif |
| 77 |
|
| 78 |
%: |
| 79 |
dh $@ -Bbuild-deb |
| 80 |
|
| 81 |
#UBSAN=-Wl,-as-needed -fsanitize=undefined -fsanitize-address-use-after-scope |
| 82 |
|
| 83 |
# Avoid re-running configure each time. See Bug#966707 |
| 84 |
override_dh_auto_configure-arch: debian/configure-stamp-arch |
| 85 |
debian/configure-stamp-arch: |
| 86 |
dh_auto_configure -Bbuild-deb -- $(CONFIGURE_ARGS) $(CONFIGURE_ARGS_deb) $(shell DEB_CFLAGS_MAINT_APPEND="-fno-omit-frame-pointer $(UBSAN)" dpkg-buildflags --export=configure) |
| 87 |
dh_auto_configure -phurd-prof -Bbuild-prof -- $(CONFIGURE_ARGS) $(CONFIGURE_ARGS_deb) $(shell DEB_CFLAGS_MAINT_APPEND="-fno-omit-frame-pointer -pg" dpkg-buildflags --export=configure) |
| 88 |
dh_auto_configure -phurd-udeb -Bbuild-udeb -- $(CONFIGURE_ARGS) $(CONFIGURE_ARGS_udeb) $(shell dpkg-buildflags --export=configure) |
| 89 |
touch $@ |
| 90 |
touch debian/configure-stamp-indep |
| 91 |
|
| 92 |
override_dh_auto_configure-indep: debian/configure-stamp-indep |
| 93 |
debian/configure-stamp-indep: |
| 94 |
# Force dumb cross-compilation |
| 95 |
dh_auto_configure -i -- --host i386-gnu MIG=true --without-parted |
| 96 |
touch $@ |
| 97 |
|
| 98 |
override_dh_auto_build-arch: |
| 99 |
@echo 'blhc: ignore-line-regexp: .* -o libstore_.*\.a -u .*' |
| 100 |
@echo 'blhc: ignore-line-regexp: .*gen_crc32table.*' |
| 101 |
ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) |
| 102 |
dh_auto_build -Bbuild-deb |
| 103 |
ifeq (,$(filter stage2 pkg.hurd.noprof,$(DEB_BUILD_PROFILES))) |
| 104 |
dh_auto_build -phurd-prof -Bbuild-prof |
| 105 |
for i in $(TRANSLATORS_PROF) ; do \ |
| 106 |
$(MAKE) -C build-prof/$$i $$i.static ; \ |
| 107 |
done |
| 108 |
endif |
| 109 |
dh_auto_build -phurd-udeb -Bbuild-udeb |
| 110 |
ifeq (,$(filter stage2,$(DEB_BUILD_PROFILES))) |
| 111 |
install -d $(CURDIR)/libdde-linux26/build/include/x86 |
| 112 |
-ln -s x86 $(CURDIR)/libdde-linux26/build/include/amd64 |
| 113 |
-ln -s asm-x86 $(CURDIR)/libdde-linux26/build/include/amd64/asm-x86_64 |
| 114 |
$(MAKE) -C libdde-linux26 BUILDDIR=$(CURDIR)/build-deb ARCH=$(ARCH) LDFLAGS= CC=$(CC) |
| 115 |
endif |
| 116 |
endif |
| 117 |
|
| 118 |
override_dh_auto_build-indep: |
| 119 |
cd build-deb/doc && make |
| 120 |
cd build-deb/doc && make version.texi && makeinfo --html --split=chapter ../../doc/hurd.texi |
| 121 |
|
| 122 |
override_dh_auto_clean: |
| 123 |
dh_auto_clean -Bbuild-deb |
| 124 |
dh_auto_clean -phurd-prof -Bbuild-prof |
| 125 |
dh_auto_clean -phurd-udeb -Bbuild-udeb |
| 126 |
$(MAKE) -C libdde-linux26 ARCH=$(ARCH) cleanall |
| 127 |
rm -f $$(find libdde-linux26 -name \*.d) |
| 128 |
rm -fr libdde-linux26/build |
| 129 |
rm -fr libdde-linux26/lib/src/gen_crc32table libdde-linux26/lib/src/crc32table.h libdde-linux26/lib/src/timeconst.h |
| 130 |
rm -f $(INSTALL_generated) |
| 131 |
|
| 132 |
override_dh_auto_install-arch: |
| 133 |
ifneq (,$(filter stage1,$(DEB_BUILD_PROFILES))) |
| 134 |
$(MAKE) -Cbuild-deb DESTDIR=$(DEB_DESTDIR) install-headers no_deps=t |
| 135 |
else |
| 136 |
dh_auto_install -Bbuild-deb --destdir=$(DEB_DESTDIR) |
| 137 |
ifeq (,$(filter stage2 pkg.hurd.noprof,$(DEB_BUILD_PROFILES))) |
| 138 |
install -d $(DEB_DESTDIR_PROF)/hurd |
| 139 |
for i in $(TRANSLATORS_PROF) ; do \ |
| 140 |
install -m 755 build-prof/$$i/$$i.static $(DEB_DESTDIR_PROF)/hurd/$$i.prof ; \ |
| 141 |
done |
| 142 |
endif |
| 143 |
dh_auto_install -phurd-udeb -Bbuild-udeb --destdir=$(DEB_DESTDIR_UDEB) |
| 144 |
ifeq (,$(filter stage2,$(DEB_BUILD_PROFILES))) |
| 145 |
install -d $(CURDIR)/debian/tmp/usr/share/libdde_linux26/build/include |
| 146 |
ln -s x86 $(CURDIR)/debian/tmp/usr/share/libdde_linux26/build/include/amd64 |
| 147 |
$(MAKE) -C libdde-linux26 INSTALLDIR=$(CURDIR)/debian/tmp/usr/share/libdde_linux26/build/include ARCH=$(ARCH) install |
| 148 |
ln -s asm-x86 $(CURDIR)/debian/tmp/usr/share/libdde_linux26/build/include/amd64/asm-x86_64 |
| 149 |
endif |
| 150 |
|
| 151 |
# runsystem is managed by update-alternatives |
| 152 |
mv debian/tmp/usr/libexec/runsystem debian/tmp/usr/libexec/runsystem.gnu |
| 153 |
|
| 154 |
# move away fakeroot, ps, uptime, vmstat and w to not conflict with the |
| 155 |
# ones from other packages |
| 156 |
mkdir -p debian/tmp/usr/bin |
| 157 |
mv debian/tmp/usr/bin/fakeroot debian/tmp/usr/bin/fakeroot-hurd |
| 158 |
mv debian/tmp/usr/bin/ps debian/tmp/usr/bin/ps-hurd |
| 159 |
mv debian/tmp/usr/bin/uptime debian/tmp/usr/bin/uptime-hurd |
| 160 |
mv debian/tmp/usr/bin/vmstat debian/tmp/usr/bin/vmstat-hurd |
| 161 |
mv debian/tmp/usr/bin/w debian/tmp/usr/bin/w-hurd |
| 162 |
|
| 163 |
ifeq (,$(filter stage2 noudeb,$(DEB_BUILD_PROFILES))) |
| 164 |
mkdir -p debian/tmp-udeb/usr/bin |
| 165 |
mv debian/tmp-udeb/usr/bin/ps debian/tmp-udeb/usr/bin/ps-hurd |
| 166 |
mv debian/tmp-udeb/usr/bin/uptime debian/tmp-udeb/usr/bin/uptime-hurd |
| 167 |
mv debian/tmp-udeb/usr/bin/vmstat debian/tmp-udeb/usr/bin/vmstat-hurd |
| 168 |
mv debian/tmp-udeb/usr/bin/w debian/tmp-udeb/usr/bin/w-hurd |
| 169 |
endif |
| 170 |
|
| 171 |
# move away halt and reboot to not conflict with sysvinit |
| 172 |
# (they will be handled as alternatives) |
| 173 |
mv debian/tmp/usr/sbin/halt debian/tmp/usr/sbin/halt-hurd |
| 174 |
mv debian/tmp/usr/sbin/reboot debian/tmp/usr/sbin/reboot-hurd |
| 175 |
|
| 176 |
# remove PIC static libraries |
| 177 |
rm -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*_pic.a |
| 178 |
rm -f debian/tmp-udeb/usr/lib/*_pic.a |
| 179 |
endif |
| 180 |
|
| 181 |
override_dh_auto_install-indep: |
| 182 |
$(MAKE) -Cbuild-deb/doc DESTDIR=$(DEB_DESTDIR) install no_deps=t |
| 183 |
|
| 184 |
override_dh_install-arch: $(INSTALL_generated) |
| 185 |
ifeq (,$(filter stage1 stage2 noudeb,$(DEB_BUILD_PROFILES))) |
| 186 |
dh_install $(addprefix -p,$(filter %-udeb,$(shell dh_listpackages))) --sourcedir=debian/tmp-udeb |
| 187 |
mkdir -p debian/hurd-udeb/usr/share/lintian/overrides |
| 188 |
install -p -m644 debian/hurd-udeb.lintian-overrides debian/hurd-udeb/usr/share/lintian/overrides/hurd-udeb |
| 189 |
sed -i -e '1s/bash/sh/' debian/hurd-udeb/usr/sbin/MAKEDEV |
| 190 |
# We need /servers/exec and startup at boot time |
| 191 |
touch debian/hurd-udeb/servers/exec |
| 192 |
touch debian/hurd-udeb/servers/startup |
| 193 |
endif |
| 194 |
dh_install -phurd-prof --sourcedir=debian/tmp-prof |
| 195 |
dh_install --remaining-packages --sourcedir=debian/tmp |
| 196 |
|
| 197 |
override_dh_installinit: |
| 198 |
dh_installinit -phurd --name=hurd-console |
| 199 |
dh_installinit --remaining-packages |
| 200 |
|
| 201 |
override_dh_installchangelogs: |
| 202 |
dh_installchangelogs -XChangeLog |
| 203 |
|
| 204 |
override_dh_missing: |
| 205 |
dh_missing --list-missing |
| 206 |
|
| 207 |
override_dh_strip: |
| 208 |
dh_strip -Nhurd-prof -Xlibdde |
| 209 |
|
| 210 |
override_dh_fixperms-arch: |
| 211 |
dh_fixperms -a |
| 212 |
ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) |
| 213 |
chmod u+s $(patsubst %,$(CURDIR)/debian/hurd%,$(SUID_PROGRAMS)) |
| 214 |
endif |
| 215 |
|
| 216 |
override_dh_makeshlibs: |
| 217 |
ifeq (,$(filter stage1 stage2 noudeb,$(DEB_BUILD_PROFILES))) |
| 218 |
dh_makeshlibs -phurd-libs0.3 --add-udeb=hurd-libs0.3-udeb |
| 219 |
endif |
| 220 |
dh_makeshlibs --remaining-packages -Xusr/lib/hurd/ |
| 221 |
|
| 222 |
override_dh_gencontrol: |
| 223 |
dh_gencontrol -- -V"built-using=$(BUILT_USING)" |
| 224 |
|
| 225 |
override_dh_clean: |
| 226 |
dh_clean |
| 227 |
rm -rf debian/tmp-udeb |
| 228 |
rm -rf debian/tmp-prof |
| 229 |
rm -f debian/configure-stamp-arch |
| 230 |
rm -f debian/configure-stamp-indep |
| 231 |
|
| 232 |
debian/%.install: debian/%.install.in |
| 233 |
cat $^ | sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' > $@ |
| 234 |
[ ! -x $< ] || chmod +x $@ |