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 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
|
export HOME = /homedoesnotexistatbuildtime
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
export DEB_TARGET_ARCH_ENDIAN ?= $(shell dpkg-architecture -qDEB_TARGET_ARCH_ENDIAN)
ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
EXTRA_CONFIGURE_FLAGS += --host $(DEB_BUILD_GNU_TYPE) --build $(DEB_BUILD_GNU_TYPE) --target $(DEB_HOST_GNU_TYPE) --enable-unregisterised
BUILD_CROSS=YES
else
EXTRA_CONFIGURE_FLAGS += --target $(DEB_HOST_GNU_TYPE)
BUILD_CROSS=NO
endif
ProjectVersion=$(shell cat VERSION)
export GHC=$(firstword $(shell bash -c "type -p ghc"))
DEB_HOOGLE_TXT_DIR = /usr/lib/ghc-doc/hoogle/
ifneq (,$(filter i386 powerpcspe x32 s390x, $(DEB_HOST_ARCH)))
EXTRA_CONFIGURE_FLAGS += --enable-unregisterised
endif
ifneq (,$(filter mips mipsel powerpc powerpcspe sparc64, $(DEB_HOST_ARCH)))
EXTRA_CONFIGURE_FLAGS += --disable-ld-override
endif
%:
ifneq (,$(filter s390x arm64 armhf, $(DEB_HOST_ARCH)))
dh $@ --max-parallel=2
else
dh $@
endif
override_dh_autoreconf:
dh_autoreconf perl -- boot
override_dh_auto_configure:
echo "SRC_HC_OPTS += -lffi -optl-pthread" >> mk/build.mk
ifeq (NO,$(BUILD_CROSS))
echo "CrossCompiling := NO" >> mk/build.mk
echo "Stage1Only := NO" >> mk/build.mk
echo "HADDOCK_DOCS := YES" >> mk/build.mk
echo "EXTRA_HADDOCK_OPTS += --mathjax=file:///usr/share/javascript/mathjax/MathJax.js" >> mk/build.mk
echo "XSLTPROC_OPTS += --nonet" >> mk/build.mk
else
echo "CrossCompiling := YES" >> mk/build.mk
echo "Stage1Only := NO" >> mk/build.mk
echo "SRC_HC_OPTS += -O0 -H64m" >> mk/build.mk
echo "GhcStage1HcOpts = -O" >> mk/build.mk
echo "GhcStage2HcOpts = -O0" >> mk/build.mk
echo "GhcLibHcOpts = -O" >> mk/build.mk
echo "SplitObjs = NO" >> mk/build.mk
echo "HADDOCK_DOCS := NO" >> mk/build.mk
echo "BUILD_SPHINX_HTML := NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF := NO" >> mk/build.mk
endif
ifeq (armhf,$(DEB_HOST_ARCH))
echo "SRC_HC_OPTS += -D__ARM_PCS_VFP" >> mk/build.mk
endif
ifeq (big, $(DEB_TARGET_ARCH_ENDIAN))
patch -p1 < debian/patches/Disable-unboxed-arrays.patch
endif
ifneq (,$(filter powerpcspe x32 s390x, $(DEB_HOST_ARCH)))
patch -p1 < debian/patches/ghc-warnings.mk-CC-Wall.patch
endif
ifneq (,$(filter i386 mips mipsel s390x, $(DEB_HOST_ARCH)))
echo "SRC_HC_OPTS += -optc--param -optcggc-min-expand=10" >> mk/build.mk
endif
ifneq (,$(filter mips64el, $(DEB_HOST_ARCH)))
echo "compiler/GHC/Hs/Instances_HC_OPTS += -optc-mxgot" >> mk/build.mk
endif
ifeq (x32,$(DEB_HOST_ARCH))
echo "INTEGER_LIBRARY = integer-simple" >> mk/build.mk
endif
ifneq (,$(filter nostrip, $(DEB_BUILD_OPTIONS)))
echo "SRC_HC_OPTS += -H32m -O0" >> mk/build.mk
echo "GhcHcOpts += -Rghc-timing -DDEBUG" >> mk/build.mk
echo "SplitObjs = NO" >> mk/build.mk
echo "STRIP = :" >> mk/build.mk
endif
ifneq (,$(filter noopt, $(DEB_BUILD_OPTIONS)))
echo "SRC_HC_OPTS += -H32m -O0" >> mk/build.mk
echo "GhcHcOpts += -O0" >> mk/build.mk
echo "GhcRtsCcOpts += -O0" >> mk/build.mk
endif
ifneq (,$(filter alpha i386 m68k mipsel hppa sh4 x32, $(DEB_HOST_ARCH)))
echo "compiler/GHC/Hs/Instances_HC_OPTS += -O0" >> mk/build.mk
endif
echo 'GhcRTSWays += $$(if $$(filter p, $$(GhcLibWays)),thr_debug_p,)' >> mk/build.mk
echo 'ghclibdir := $${libdir}/ghc' >> mk/build.mk
echo 'bindir := /usr/bin' >> mk/build.mk
echo 'docdir := $$(datarootdir)/doc/ghc-doc' >> mk/build.mk
echo 'htmldir := $$(docdir)' >> mk/build.mk
echo 'dvidir := $$(docdir)' >> mk/build.mk
echo 'pdfdir := $$(docdir)' >> mk/build.mk
echo 'psdir := $$(docdir)' >> mk/build.mk
echo 'STRIP_CMD = $(DEB_HOST_GNU_TYPE)-strip' >> mk/build.mk
echo 'RANLIB_CMD = $(DEB_HOST_GNU_TYPE)-ranlib'>> mk/build.mk
echo 'V=1' >> mk/build.mk
dh_auto_configure -- \
$(EXTRA_CONFIGURE_FLAGS) \
--with-system-libffi --libdir=/usr/lib
override_dh_auto_build-indep:
dh_auto_build -i -- all docs
override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
rm -rf debian/testghc
mkdir debian/testghc
echo 'main = putStrLn "Foo"' > debian/testghc/foo.hs
inplace/bin/ghc-stage2 debian/testghc/foo.hs -o debian/testghc/foo
[ "$$(debian/testghc/foo)" = "Foo" ]
rm debian/testghc/*
echo 'main = putStrLn "Foo"' > debian/testghc/foo.hs
inplace/bin/ghc-stage2 debian/testghc/foo.hs -o debian/testghc/foo -O2
[ "$$(debian/testghc/foo)" = "Foo" ]
rm debian/testghc/*
@printf "====BEGIN GHC INFO OUTPUT====\n"
@inplace/bin/ghc-stage2 --info
@printf "====END GHC INFO OUTPUT====\n"
endif
FILES = \( -type f -o -type l \)
PROF_FILE = \( -name "*.p_*" -o -name "lib*_p.a" \)
override_dh_auto_install-arch:
dh_auto_install --no-parallel
find debian/tmp -name \*.haddock.t -delete
mkdir -p debian/tmp/usr/share/lintian/overrides
echo "ghc binary: extra-license-file `cd debian/tmp && echo usr/lib/ghc/Cabal-*/Distribution/License.hi`" >> debian/tmp/usr/share/lintian/overrides/ghc
echo "ghc: extra-license-file `cd debian/tmp && echo usr/lib/ghc/Cabal-*/Distribution/License.dyn_hi`" >> debian/tmp/usr/share/lintian/overrides/ghc
echo "ghc-prof binary: extra-license-file `cd debian/tmp && echo usr/lib/ghc/Cabal-*/Distribution/License.p_hi`" >> debian/tmp/usr/share/lintian/overrides/ghc-prof
if ! test -d debian/tmp/var/lib/ghc/package.conf.d ; then \
mkdir -p debian/tmp/var/lib/ghc ;\
mv debian/tmp/usr/lib/ghc/package.conf.d debian/tmp/var/lib/ghc/ ;\
rm debian/tmp/var/lib/ghc/package.conf.d/package.cache ;\
fi
rm -rf debian/tmp/usr/lib/ghc/package.conf.d
sed -ri 's,/usr/share/doc/ghc-doc/html/libraries/(.*)\.haddock,/usr/lib/ghc-doc/haddock/ghc/\1.haddock,' debian/tmp/var/lib/ghc/package.conf.d/*.conf
if inplace/bin/ghc-stage2 --info | grep '"Have interpreter","NO"'; then \
cd debian/tmp/usr/bin ;rm -f ghci* runghc* runhaskell*; \
fi
echo ".so man1/ghc.1" > debian/tmp/usr/share/man/man1/ghc-$(ProjectVersion).1
if test -e debian/tmp/usr/bin/ghci-$(ProjectVersion); then \
echo ".so man1/ghc.1" > debian/tmp/usr/share/man/man1/ghci.1 ;\
echo ".so man1/ghc.1" > debian/tmp/usr/share/man/man1/ghci-$(ProjectVersion).1 ;\
cp debian/runghc.man debian/tmp/usr/share/man/man1/runghc.1 ; fi
cp utils/hp2ps/hp2ps.1 debian/tmp/usr/share/man/man1/hp2ps.1
cp debian/ghc-pkg.man debian/tmp/usr/share/man/man1/ghc-pkg.1
echo ".so man1/ghc-pkg.1" > debian/tmp/usr/share/man/man1/ghc-pkg-$(ProjectVersion).1
cp debian/haddock.man debian/tmp/usr/share/man/man1/haddock.1
find debian/tmp/usr/share/man $(FILES) >> debian/ghc.install
find debian/tmp/usr/bin $(FILES) >> debian/ghc.install
find debian/tmp/usr/lib/ghc $(FILES) ! $(PROF_FILE) >> debian/ghc.install
find debian/tmp/var >> debian/ghc.install
echo debian/tmp/usr/share/lintian/overrides/ghc >> debian/ghc.install
rm -f debian/ghc.links
echo "/var/lib/ghc/package.conf.d /usr/lib/ghc/package.conf.d" >> debian/ghc.links
find debian/tmp/usr/lib $(FILES) $(PROF_FILE) > debian/ghc-prof.install
echo debian/tmp/usr/share/lintian/overrides/ghc-prof >> debian/ghc-prof.install
sed -i s,^debian/tmp,, debian/*.install debian/*.links
override_dh_auto_install-indep:
dh_auto_install --no-parallel -- install install_docs
rm -f debian/tmp/usr/share/doc/ghc-doc/html/libraries/*/LICENSE
if ! test -d debian/tmp/var/lib/ghc/package.conf.d ; then \
mkdir -p debian/tmp/var/lib/ghc ;\
mv debian/tmp/usr/lib/ghc/package.conf.d debian/tmp/var/lib/ghc/ ;\
rm debian/tmp/var/lib/ghc/package.conf.d/package.cache ;\
fi
rm -rf debian/tmp/usr/lib/ghc/package.conf.d
mkdir -p debian/tmp/usr/lib/ghc-doc
cp debian/gen_contents_index debian/tmp/usr/lib/ghc-doc/
chmod +x debian/tmp/usr/lib/ghc-doc/gen_contents_index
mkdir debian/tmp/usr/lib/ghc-doc/haddock
mkdir debian/tmp/usr/lib/ghc-doc/haddock/ghc/
for f in `find debian/tmp/usr/share/doc/ghc-doc/html/libraries/ -maxdepth 1 -mindepth 1 -type d`; do \
mkdir debian/tmp/usr/lib/ghc-doc/haddock/ghc/`basename $$f` ; \
mv $$f/*.haddock debian/tmp/usr/lib/ghc-doc/haddock/ghc/`basename $$f` ; done
cd debian/tmp/usr/share/doc/ghc-doc/html/libraries/; ln -s ghc-$(ProjectVersion) ghc
install -Dm 644 debian/index.html debian/tmp/usr/share/doc/ghc-doc/index.html
mkdir -p debian/tmp/$(DEB_HOOGLE_TXT_DIR)
find debian/tmp/usr/share/doc/ghc-doc/html/libraries/*/ -name "*.txt" \
-printf "%p $(DEB_HOOGLE_TXT_DIR)/%f\n" >> debian/ghc-doc.links
find debian/tmp/usr/share/doc/ghc-doc $(FILES) > debian/ghc-doc.install
find debian/tmp/usr/lib/ghc-doc $(FILES) >> debian/ghc-doc.install
sed -i s,^debian/tmp,, debian/*.install debian/*.links
override_dh_auto_clean:
dh_auto_clean
rm -f mk/build.mk
rm -f debian/*.install
rm -f debian/*.1
rm -f debian/ghc.manpages
rm -f debian/ghc.links
rm -f debian/ghc-doc.links
rm -f mk/build.mk
rm -rf debian/testghc
rm -f ch01.html ch02.html index.html
rm -rf debian/tmp-db
rm -f config.log
rm -f libraries/ghc-prim/GHC/PrimopWrappers.hs
rm -f libraries/ghc-prim/GHC/Prim.hs
rm -f libraries/ghc-prim/GHC/Generics.hc
rm -f libraries/ghc-prim/GHC/Generics.dyn_hc
rm -f libraries/ghc-prim/GHC/IntWord32.hc
rm -f libraries/integer-gmp/GHC/Integer/Type.hc
rm -f libraries/base/GHC/ConsoleHandler.hc
rm -f libraries/base/GHC/IO/Encoding/CodePage.hc
rm -f libraries/base/Unsafe/Coerce.hc
rm -f rts/libs.depend mk/install.mk
rm -f rts/package.conf.install.raw
rm -f rts/package.conf.inplace.raw
rm -f utils/ghc-pwd/dist-boot/Main.hi
rm -f utils/ghc-pwd/dist-boot/Main.o
rm -f utils/ghc-pwd/dist-boot/ghc-pwd
rm -f libraries/haskeline/a.out
rm -rf utils/ghctags/dist-install
override_dh_compress:
dh_compress -X.haddock -X.txt
override_dh_gencontrol:
chmod +x debian/provided_substvars
debian/provided_substvars
if test -e debian/tmp/usr/bin/ghci-$(ProjectVersion); then \
echo 'ghci=ghc-ghci' >> debian/ghc.substvars ; fi
ifeq (NO,$(BUILD_CROSS))
echo "haddock:Provides=haddock-interface-$$(debian/tmp/usr/lib/ghc/bin/haddock --interface-version)" >> debian/ghc.substvars
echo "haddock:Depends=haddock-interface-$$(debian/tmp/usr/lib/ghc/bin/haddock --interface-version)" >> debian/ghc-doc.substvars
endif
dh_haskell_provides
dh_gencontrol
override_dh_shlibdeps:
dh_shlibdeps -XlibHS
override_dh_makeshlibs:
override_dh_strip:
dh_strip --no-automatic-dbgsym
|