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
|
#!/usr/bin/make -f
# This file is public domain software, originally written by Joey Hess.
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
TAR_DIR = coreutils-6.10
# the dbs rules
include /usr/share/dbs/dbs-build.mk
include /usr/share/dbs/dpkg-arch.mk
# work around dpkg changes
DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null)
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
ifeq ($(DEB_HOST_ARCH_CPU),)
DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
ifeq ($(DEB_HOST_ARCH_CPU),x86_64)
DEB_HOST_ARCH_CPU := amd64
endif
endif
ifeq ($(DEB_HOST_ARCH_OS),)
DEB_HOST_ARCH_OS := $(subst -gnu,,$(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM))
ifeq ($(DEB_HOST_ARCH_OS),gnu)
DEB_HOST_ARCH_OS := hurd
endif
endif
# implement no optimization build option
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS = "-g -DSYSLOG_SUCCESS -DSYSLOG_FAILURE -DSYSLOG_NON_ROOT -O0"
else
CFLAGS = "-g -DSYSLOG_SUCCESS -DSYSLOG_FAILURE -DSYSLOG_NON_ROOT -O2"
endif
LDFLAGS =
# programs to include/not include
ifeq ($(DEB_HOST_ARCH_OS),hurd)
BUILDPROG_OPTS := --enable-install-program=su
endif
BIN_PROGS = cat chgrp chmod chown cp date dd df dir echo false ln ls mkdir \
mknod mv pwd readlink rm rmdir vdir sleep stty sync touch true uname
d=debian/coreutils
default: binary
configure: configure-stamp
configure-stamp: $(patched)
dh_testdir
cd $(BUILD_TREE) && CFLAGS=$(CFLAGS) \
LDFLAGS=$(LDFLAGS) ./configure \
--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
--prefix=/usr -v \
--infodir=/usr/share/info --mandir=/usr/share/man \
$(BUILDPROG_OPTS)
touch configure-stamp
build: configure-stamp build-stamp
build-stamp: $(patched)
dh_testdir
cd $(BUILD_TREE) && $(MAKE)
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
[ -r /proc/cpuinfo ] && cat /proc/cpuinfo
cd $(BUILD_TREE) && $(MAKE) check VERBOSE=yes
endif
touch build-stamp
clean:
dh_testdir
rm -f build-stamp configure-stamp
rm -rf $(STAMP_DIR) $(SOURCE_DIR) debian/buildinfo
dh_clean
install:
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
cd $(BUILD_TREE) && $(MAKE) install DESTDIR=$(CURDIR)/$(d)
# some things go in root rather than usr
for f in $(BIN_PROGS); do \
mv $(d)/usr/bin/$$f $(d)/bin/$$f; \
done
# backward compatability
ln -s /usr/bin/md5sum $(d)/usr/bin/md5sum.textutils
ln -s /usr/share/man/man1/md5sum.1 $(d)/usr/share/man/man1/md5sum.textutils.1
ifneq ($(DEB_HOST_ARCH_OS),hurd)
# touch used to be in /usr/bin, don't break scripts
ln -s /bin/touch $(d)/usr/bin/touch
endif
# remove stuff provided by other packages
ifeq ($(DEB_HOST_ARCH_OS),linux)
# kill from procps is linux-specific
rm -f $(d)/usr/bin/kill $(d)/usr/share/man/man1/kill.1
else
mv $(d)/usr/bin/kill $(d)/bin
endif
ifneq ($(DEB_HOST_ARCH_OS),hurd)
rm -f $(d)/usr/bin/su $(d)/usr/share/man/man1/su.1
endif
rm -f $(d)/usr/bin/hostname $(d)/usr/share/man/man1/hostname.1
rm -f $(d)/usr/bin/uptime $(d)/usr/share/man/man1/uptime.1
rm -f $(d)/usr/bin/mktemp $(d)/usr/share/man/man1/mktemp.1
# the [ program doesn't have its own man page yet
ln -s test.1 $(d)/usr/share/man/man1/[.1
# gnu thinks chroot is in bin, debian thinks it's in sbin
install -d $(d)/usr/sbin $(d)/usr/share/man/man8
mv $(d)/usr/bin/chroot $(d)/usr/sbin/chroot
sed s/\"1\"/\"8\"/1 $(d)/usr/share/man/man1/chroot.1 > $(d)/usr/share/man/man8/chroot.8
rm $(d)/usr/share/man/man1/chroot.1
cp $(BUILD_TREE)/AUTHORS \
$(BUILD_TREE)/NEWS $(BUILD_TREE)/README \
$(BUILD_TREE)/THANKS \
$(BUILD_TREE)/TODO \
$(d)/usr/share/doc/coreutils
dh_install
# Build architecture-independent files here.
binary-indep: build install
dh_testdir -i
dh_testroot -i
dh_installchangelogs -i
dh_installdocs -i
dh_buildinfo
dh_installexamples -i
dh_installinfo -i
dh_installman -i
dh_link -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir -a
dh_testroot -a
dh_installchangelogs -a $(BUILD_TREE)/ChangeLog
dh_installdocs -a
dh_buildinfo -a
dh_installexamples -a
dh_installinfo -a $(BUILD_TREE)/doc/coreutils.info
dh_installman -a
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
dh_strip -a
endif
dh_link -a
dh_compress -a
dh_fixperms -a
ifeq ($(DEB_HOST_ARCH_OS),hurd)
chmod u+s $(d)/usr/bin/su
endif
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
|