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 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
|
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets by Bill Allombert 2001
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
SHELL = bash
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_GNU_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
DEB_BUILD_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
# Add backward compatibility to allow backport to stable
ifeq ($(DEB_HOST_GNU_SYSTEM), linux)
DEB_HOST_GNU_SYSTEM=linux-gnu
endif
ifeq ($(DEB_BUILD_GNU_SYSTEM), linux)
DEB_BUILD_GNU_SYSTEM=linux-gnu
endif
GRUB_VERSION=0.97
GRUB_DISK_IMAGE=grub-${GRUB_VERSION}-$(DEB_BUILD_GNU_CPU)-pc
ifeq ($(DEB_BUILD_GNU_SYSTEM),linux-gnu)
filesystems=e2fs jfs minix reiserfs xfs fat
endif
ifeq ($(DEB_BUILD_GNU_SYSTEM),gnu)
filesystems=e2fs ffs minix
endif
ifeq ($(DEB_BUILD_GNU_SYSTEM),kfreebsd-gnu)
filesystems=e2fs ffs ufs2
endif
ifeq ($(DEB_BUILD_GNU_SYSTEM),knetbsd-gnu)
filesystems=e2fs ffs ufs2
endif
ifeq ($(DEB_BUILD_GNU_CPU),x86_64)
LDFLAGS=-static
endif
CC=gcc
patch: patch-stamp
patch-stamp:
dh_testdir
# Add here commands to patch the source..
set -e ; for i in `cat debian/patches/00list | grep -v ^#` ; \
do \
echo "--- $$i ---" ; patch -p1 < debian/patches/$$i ; \
done
touch patch-stamp
unpatch:
dh_testdir
# Add here commands to reverse patchs to the source.
if [ -f patch-stamp ] ; then \
set -e ; for i in `tac debian/patches/00list | grep -v ^#` ; \
do \
echo "--- $$i ---" ; patch -R -p1 < debian/patches/$$i ; \
done ; \
fi \
if [ -f patch-stamp ] ; then \
rm patch-stamp ; \
fi
configure: configure-stamp
configure-stamp: patch-stamp
dh_testdir
# Add here commands to configure the package.
aclocal-1.9 && automake-1.9 && autoconf
CC=$(CC) LDFLAGS=$(LDFLAGS) ./configure \
--host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-auto-linux-mem-opt
touch configure-stamp
build: build-arch
build-arch: build-arch-stamp
build-arch-stamp: configure-stamp
dh_testdir
# Add here commands to compile the package.
$(MAKE)
## the creation of these manpages here is temporary,
## when building grub finally works with the version
## of autoconf in debian we can use MAINTAINER_MODE_TRUE
# create man page for grub
( cd docs && ./help2man \
--name="the grub shell" \
--include=grub.8.additions \
--section=8 --output=grub.8 \
../grub/grub )
# create man page for grub-install
( cd util && chmod 755 grub-install )
( cd docs && ./help2man \
--name="install GRUB on your drive" \
--include=grub-install.8.additions \
--section=8 --output=grub-install.8 \
../util/grub-install )
# create man page for mbchk
( cd docs && ./help2man \
--name="check the format of a Multiboot kernel" \
--section=1 --output=mbchk.1 \
../util/mbchk )
# create man page for grub-md5-crypt
( cd util && chmod 755 grub-md5-crypt )
( cd docs && ./help2man \
--name="Encrypt a password in MD5 format" \
--section=8 --output=grub-md5-crypt.8 \
../util/grub-md5-crypt )
touch build-arch-stamp
build-indep: build-indep-stamp
build-indep-stamp: configure-stamp
dh_testdir
# create html documentation from texi files
( cd docs && texi2html -split_chapter grub.texi )
( cd docs && texi2html -split_chapter multiboot.texi )
touch build-indep-stamp
clean:
dh_testdir
dh_testroot
rm -f build-arch-stamp build-indep-stamp configure-stamp config.log
# Add here commands to clean up after the build process.
-$(MAKE) distclean
# The Makefile doesn't clean up the generated info files so we will do
# it here so the doco is uptodate.
-( cd docs && rm -f *.info* )
# clean up generated html documentation
-( cd docs && rm -f *.html )
# clean up documentation directory removing created dirs.
-( cd docs && rm -rf grub multiboot )
# remove files that will be change due our automake and autoconf rebuilding
-rm -f $(shell find . -name 'Makefile.in' -o \
-name 'aclocal.m4' -o \
-name 'configure')
# reverse patches we applied. this has to happen after make distclean
-$(MAKE) -s -f debian/rules unpatch
dh_clean
install: install-indep install-arch
install-indep: install-arch
dh_testdir
dh_testroot
dh_clean -k -i
dh_installdirs -i
# Add here commands to install the indep part of the package into
# debian/<package>-doc.
#INSTALLDOC#
# grub-disk
mkdir -p $(CURDIR)/debian/tmp/root/boot/grub
cp $(CURDIR)/debian/grub/usr/lib/grub/*-*/{stage1,e2fs_stage1_5,stage2} \
$(CURDIR)/docs/menu.lst \
$(CURDIR)/debian/tmp/root/boot/grub
tar -C $(CURDIR)/debian/tmp/root \
-cvzf $(CURDIR)/debian/tmp/grub.tar.gz boot
chmod +x $(CURDIR)/util/mkbimage
$(CURDIR)/util/mkbimage -t 1.44 \
-d $(CURDIR)/debian/tmp/ -s ext2 \
-f $(CURDIR)/debian/tmp/grub.tar.gz
rm -f $(CURDIR)/debian/tmp/root/boot/grub/*stage*
cp $(CURDIR)/debian/grub/usr/lib/grub/*-*/stage2_eltorito \
$(CURDIR)/debian/tmp/root/boot/grub
mkisofs \
-b boot/grub/stage2_eltorito \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-o $(CURDIR)/debian/tmp/raw.iso \
-r $(CURDIR)/debian/tmp/root
gzip -c9 $(CURDIR)/debian/tmp/1.44.image > \
$(CURDIR)/debian/grub-disk/usr/share/grub-disk/${GRUB_DISK_IMAGE}.ext2fs.gz
cp $(CURDIR)/debian/tmp/raw.iso \
$(CURDIR)/debian/grub-disk/usr/share/grub-disk/${GRUB_DISK_IMAGE}.iso
dh_install -i
install-arch:
dh_testdir
dh_testroot
dh_clean -k -s
dh_installdirs -s
# Add here commands to install the package into debian/grub.
$(MAKE) install DESTDIR=$(CURDIR)/debian/grub/
# make install puts the info files in the grub package but we want them
# in the grub-doc package so lets clean shop and let dh_installinfo do
# the work
rm -rf debian/grub/usr/share/info
# Cleanup filesystems not used natively in Debian.
# (non-native filesystems are supported via stage2)
mkdir debian/grub/usr/lib/grub/tmp/
mv debian/grub/usr/lib/grub/*-*/*_stage1_5 \
debian/grub/usr/lib/grub/tmp/
for i in $(filesystems) ; do \
mv debian/grub/usr/lib/grub/tmp/$${i}_stage1_5 \
debian/grub/usr/lib/grub/*-*/ ; \
done
rm -rf debian/grub/usr/lib/grub/tmp/
dh_install -s
# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
# Add a wrapper for update-grub. Remove it post-etch
cp debian/update-grub.wrapper debian/grub/sbin/update-grub
# Add a wrapper for grub-install. Remove it post-etch
cp debian/grub-install.wrapper debian/grub/sbin/grub-install
dh_testdir
dh_testroot
dh_installchangelogs ChangeLog
dh_installdocs
dh_installexamples
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_installinit
# dh_installcron
dh_installinfo
dh_installman
# dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
# dh_python
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
# Build architecture independant packages using the common target.
binary-indep: build-indep install-indep
$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
# Build architecture dependant packages using the common target.
binary-arch: build-arch install-arch
$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
# Grab fixes from CVS using our version as reference.
cvs-sync:
cvs -d:pserver:anonymous@cvs.savannah.gnu.org:/cvsroot/grub checkout -d grub-cvs grub; \
UVERSION=$$(dpkg-parsechangelog | grep Version | sed 's,Version: ,,g;s,-[0-9]*$$,,g;s,\.,_,g'); \
cd grub-cvs && \
cvs diff -uN -r release_$$UVERSION -r HEAD \
| sed 's,^\(---\|+++\) \(.*\)$$,\1 foo/\2,g' \
| filterdiff -x '*/.cvsignore' -x '*/docs/version.texi' -x '*/docs/stamp-vti' > ../debian/patches/cvs-sync.patch; \
cd .. && rm -rf grub-cvs
binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure patch unpatch
|