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
|
#!/usr/bin/make -f
#
# Debian Makefile for gprbuild
# Copyright (c) 2009, 2010 Stephen Leake <stephen_leake@stephe-leake.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# To update to a new upstream version:
# install the quilt package
# edit version in ../src/gpr_version.ads
# edit patches/version.patch to match (use "quilt edit file_name" then "quilt refresh")
# update other patches as appropriate
# edit control to match
#
# To build this package in a chroot:
# schroot -d `cd ..; pwd` --chroot=unstable -- dpkg-buildpackage -uc -us
#
# To run lintian:
# schroot -d `cd ..; pwd` --chroot=unstable -- make -f debian/rules lint
#
# To install the packages and run the examples:
#
# one time setup (see comment in test_installed.sh about compiler versions):
# sudo schroot --chroot=unstable -- aptitude install --without-recommends gnat-4.6-sjlj
# sudo schroot --chroot=unstable -- aptitude install --without-recommends gcc-4.4
# sudo schroot --chroot=unstable -- aptitude install --without-recommends g++-4.6
# sudo schroot --chroot=unstable -- aptitude install --without-recommends gfortran-4.6
# sudo schroot --chroot=unstable -- aptitude install --without-recommends liblapack3gf
# sudo schroot --chroot=unstable -- aptitude install --without-recommends libaunit2-dev
#
# run the test:
# schroot --chroot=unstable -- ./test_installed.sh
#
# to clean up after the test:
# sudo schroot --chroot=unstable -- ./test_clean.sh
.SUFFIXES=
# We use gnatmake, not make, for parallel builds.
.NOTPARALLEL:
export CPUS := $(shell getconf _NPROCESSORS_ONLN)
# Targets mandated by the Debian Policy
.PHONY: build binary binary-arch binary-indep clean
build: build-arch build-indep
build-arch: generate-stamp build-stamp
build-indep: generate-stamp build-stamp
C_OBJS := debian/tmp/obj/gprbuild_dummies.o debian/tmp/obj/link.o
generate-stamp: src/gprconfig-sdefault.ads sdefault-body-stamp snames-stamp
build-stamp: $(C_OBJS)
dh_testdir
gnatmake -j$(CPUS) -p -Pdebian/gprbuild_build
touch $@
# The upstream Makefile builds these C files with no optimization. The
# functions in gprbuild_dummies.c just call abort; link.c only has
# constant object declarations. So it doesn't hurt to have $(CFLAGS) here.
debian/tmp/obj/gprbuild_dummies.o: src/gprbuild_dummies.c | debian/tmp/obj
gcc -c $(CFLAGS) -o $@ $<
debian/tmp/obj/link.o: gnat/link.c | debian/tmp/obj
gcc -c $(CFLAGS) -o $@ $<
debian/tmp/obj:
mkdir -p $@
# It is important to use the default Ada compiler driver as opposed to
# the default C compiler driver; they may be different on the build
# host.
#
# note that dpkg-architecture uses 'gcc' not 'gnatgcc', but that
# doesn't matter; the architecture is not compiler version dependent.
DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
target := $(shell gnatgcc -dumpmachine)
version := $(shell gnatgcc -dumpversion)
libsubdir := /usr/lib/$(DEB_HOST_MULTIARCH)/gcc/$(target)/$(version)
src/gprconfig-sdefault.ads :
echo "package GprConfig.Sdefault is" > src/gprconfig-sdefault.ads
echo " pragma Warnings (Off);" >> src/gprconfig-sdefault.ads
echo " Hostname : constant String := \"$(target)\";" >> src/gprconfig-sdefault.ads
echo "end GprConfig.Sdefault;" >> src/gprconfig-sdefault.ads
sdefault-body-stamp:
echo "pragma Style_Checks (Off);" > gnat/sdefault.adb
echo "package body Sdefault is" >> gnat/sdefault.adb
echo " function Include_Dir_Default_Name return String_Ptr is" >> gnat/sdefault.adb
echo " begin" >> gnat/sdefault.adb
echo " return new String'(\"$(libsubdir)/adainclude/\");" >> gnat/sdefault.adb
echo " end Include_Dir_Default_Name;" >> gnat/sdefault.adb
echo " function Object_Dir_Default_Name return String_Ptr is" >> gnat/sdefault.adb
echo " begin" >> gnat/sdefault.adb
echo " return new String'(\"$(libsubdir)/adalib/\");" >> gnat/sdefault.adb
echo " end Object_Dir_Default_Name;" >> gnat/sdefault.adb
echo " function Target_Name return String_Ptr is" >> gnat/sdefault.adb
echo " begin" >> gnat/sdefault.adb
echo " return new String'(\"$(target)/\");" >> gnat/sdefault.adb
echo " end Target_Name;" >> gnat/sdefault.adb
echo " function Search_Dir_Prefix return String_Ptr is" >> gnat/sdefault.adb
echo " begin" >> gnat/sdefault.adb
echo " return new String'(\"/usr/share/ada/adainclude/\");" >> gnat/sdefault.adb
echo " end Search_Dir_Prefix;" >> gnat/sdefault.adb
echo "end Sdefault;" >> gnat/sdefault.adb
touch sdefault-body-stamp
snames-stamp:
(cd gnat; gnatmake -q xsnamest ; ./xsnamest )
mv gnat/snames.ns gnat/snames.ads
mv gnat/snames.nb gnat/snames.adb
mv gnat/snames.nh gnat/snames.h
touch snames-stamp
clean:
dh_testdir
dh_testroot
dh_clean -a
rm -rf debian/gprbuild-doc
rm -f debian/gprbuild-doc.substvars
rm -f *-stamp
rm -f src/gprconfig-sdefault.ads
rm -f src/sdefault.adb
rm -f gnat/snames.ads
rm -f gnat/snames.adb
rm -f gnat/snames.h
rm -f gnat/xsnamest
rm -f gnat/xsnamest.ali
rm -f gnat/xsnamest.o
rm -f gnat/xutil.ali
rm -f gnat/xutil.o
binary: binary-indep binary-arch
# we are not patching the doc sources, so we can just install the
# pre-built files from the orig tarball.
binary-indep:
dh_installchangelogs -p gprbuild-doc
dh_installdocs -p gprbuild-doc doc/html
dh_installinfo -p gprbuild-doc doc/info/gprbuild_ug.info
dh_installdocs -p gprbuild-doc doc/pdf/gprbuild_ug.pdf
dh_installdocs -p gprbuild-doc features-*
dh_installdocs -p gprbuild-doc known-problems-*
dh_installexamples -p gprbuild-doc examples/*
dh_lintian -p gprbuild-doc
dh_compress -p gprbuild-doc
dh_fixperms -p gprbuild-doc
dh_gencontrol -p gprbuild-doc
dh_md5sums -p gprbuild-doc
dh_builddeb -p gprbuild-doc
# not clear why gprbuild_gps.xml is marked executable; fix it here
# (not covered by dh_fixperms)
binary-arch: build
dh_testdir
dh_testroot
dh_installchangelogs -p gprbuild
dh_install -p gprbuild debian/tmp/gprbuild usr/bin
dh_install -p gprbuild debian/tmp/gprclean usr/bin
dh_install -p gprbuild debian/tmp/gprconfig usr/bin
dh_install -p gprbuild debian/tmp/gprbind usr/lib
dh_install -p gprbuild debian/tmp/gprlib usr/lib
dh_install -p gprbuild doc/gprbuild_gps.xml /usr/share/gps/plug-ins/
chmod a-x debian/gprbuild/usr/share/gps/plug-ins/gprbuild_gps.xml
dh_strip -p gprbuild
dh_install -p gprbuild share/gprconfig/* /usr/share/gprconfig
dh_installman -p gprbuild debian/gprbuild.1 debian/gprclean.1 debian/gprconfig.1
dh_installdocs -p gprbuild
dh_fixperms
dh_lintian -p gprbuild
dh_shlibdeps -p gprbuild
dh_compress -p gprbuild
dh_fixperms -p gprbuild
dh_gencontrol -p gprbuild
dh_md5sums -p gprbuild
dh_builddeb -p gprbuild
lint: version := $(shell dpkg-parsechangelog | grep "Version: " | sed "s/Version: //")
lint: arch := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
lint:
cd ..; lintian -i gprbuild_$(version)_$(arch).changes
# end of file
|