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
|
#!/usr/bin/make -f
# debian/rules for Castle Game Engine
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk
export DH_ALWAYS_EXCLUDE := COPYING:LICENSE
export LANG:=C
# Documentation type to use chm/html
ifeq (${DEBDOCTYPE},)
DOCTYPE=html
# HTML Converter chmdocs or htmldocs for (default)
CONVERTER=${DOCTYPE}docs
else
DOCTYPE=${DEBDOCTYPE}
CONVERTER=${DOCTYPE}docs
endif
# Define FPC
ifndef FPC
FPC=/usr/bin/fpc
endif
# Set FPCVER
FPCVER=$(shell ${FPC} -iV)
CPU_TARGET?=$(shell ${FPC} -iTP)
OS_TARGET?=$(shell ${FPC} -iTO)
FPCTARGET=${CPU_TARGET}-${OS_TARGET}
# Used in dh-exec enhanced files
export CGE_VERSION=$(shell echo ${DEB_VERSION_UPSTREAM} | sed -e 's/^\([0-9\.]*\).*/\1/')
DEB_BUILD=$(lastword $(subst -, ,${DEB_VERSION}))
ifndef PACKAGESUFFIX
PACKAGESUFFIX=-${CGE_VERSION}
endif
# Get directories
INSTALL_DIR=$(CURDIR)/debian/tmp
LIB_DIR=${INSTALL_DIR}/usr/lib/${DEB_SOURCE}/${CGE_VERSION}
SRC_DIR=$(CURDIR)/debian/src/${DEB_SOURCE}-${CGE_VERSION}
UNITS_DIR=${INSTALL_DIR}/usr/lib/${DEB_HOST_MULTIARCH}/fp-units-${FPCVER}/${DEB_SOURCE}-${CGE_VERSION}
TMP_DIR=${INSTALL_DIR}/tmp
# Get utils
ifndef MKDIR
MKDIR=mkdir -p
endif
ifndef CP
CP=cp -Rfpl
endif
RM:=rm -rf
#export DH_VERBOSE=1
%:
dh ${@}
override_dh_auto_clean:
${MAKE} cleanall
$(MAKE) strip-precompiled-libraries
dh_auto_clean
prepare-source: prepare-source-stamp
prepare-source-stamp:
# Building Pascal style font file first while making sure that
# no unit or object files polute the source tree
${MKDIR} ${TMP_DIR}
${FPC} -FE${TMP_DIR} @castle-fpc.cfg tools/texture-font-to-pascal/texture-font-to-pascal.lpr
cd src/fonts ; PATH=${PATH}:${TMP_DIR} ./mk_fonts.sh
# cge embeds some images from xcf via png into Pascal source files
# First we need to create the pngs
for pngfile in $$(grep \\\.png\$$ debian/clean) ; do convert -layers flatten -background transparent $${pngfile%.png}.xcf $${pngfile} ; done
# Then we build the helper function
${FPC} -FE${TMP_DIR} -dRELEASE @castle-fpc.cfg tools/image-to-pascal/image-to-pascal.lpr
# To finally convert png files to pas file
PATH=${TMP_DIR} ${MAKE} -C src/ui/opengl/gui-images all
# Upstream source contains auto-generated include files. Let's generate
# them again.
${FPC} -FE${TMP_DIR} -dRELEASE @castle-fpc.cfg src/x3d/nodes_specification/x3d-nodes-to-pascal/x3d-nodes-to-pascal.lpr
cd src/x3d/nodes_specification/x3d-nodes-to-pascal ; \
PATH=${TMP_DIR} x3d-nodes-to-pascal ../components/*.txt
# For reproducible builds we need to make sure the timestamp of the just
# created files is fixed. Let's use SOURCE_DATE_EPOCH for that. For the
# future, this needs to be even smarter, because now every Debian revision
# will require all the reverse dependencies generating ppu files to be
# rebuild.
touch --no-dereference --date="@$${SOURCE_DATE_EPOCH}" \
src/x3d/auto_generated_node_helpers/*.inc \
src/fonts/castletexturefont_*.pas \
src/ui/opengl/castlecontrolsimages.*
touch prepare-source-stamp
# Annoying thing is we need to do this very early to save lots of overhead. If
# it can be done on a clean tree, right after prepare-source we don't need
# cleaning, right.
install-source: install-source-stamp
install-source-stamp:
@echo "--- Copying the source code"
dh_testdir
${MKDIR} ${SRC_DIR}
${CP} -t ${SRC_DIR} \
$(CURDIR)/src/*
find $(SRC_DIR) -name '*.bmp' -exec chmod 644 '{}' ';'
find ${SRC_DIR} -empty -delete
touch install-source-stamp
override_dh_auto_build-arch: prepare-source install-source
# Build the real engine
${MAKE} all
# Generate man pages
${MAKE} -C doc/man/man1
override_dh_auto_test-arch:
# Command basically copied from tests/compile_console.sh while
# making sure that no unit or object files polute the source tree
${FPC} -gh -dDEBUG -dTEXT_RUNNER -dNO_WINDOW_SYSTEM \
-Fuexamples/research_special_rendering_methods/shadow_fields/ \
-Fuexamples/curves_surfaces/ \
-FE${TMP_DIR} \
@castle-fpc.cfg tests/test_castle_game_engine.lpr
# cd is needed to find the data files
cd tests ; ${TMP_DIR}/test_castle_game_engine -a
override_dh_auto_install-arch:
# Install units
${MKDIR} ${UNITS_DIR}
${CP} -t ${UNITS_DIR} units/${FPCTARGET}/*
# Mark package as manually compilable and install them
for package in $$(find * -name '*.lpk') ; \
do \
pkgDir=$$(dirname "${LIB_DIR}/$${package}") ; \
${MKDIR} "$${pkgDir}" ; \
sed -e 's@\(\W*\)<CompilerOptions>.*@\1<AutoUpdate Value="Manually"/>\n&@' \
-e "s@\.\./src/@$$(relpath ${SRC_DIR} $${pkgDir})/@g" \
-e "s@\(\W*\)<UnitOutputDirectory .*@<UnitOutputDirectory Value=\"$$(relpath ${UNITS_DIR} $${pkgDir})\"/>@" \
"$${package}" > "${LIB_DIR}/$${package}" ; \
done
# Call upstream install target for the tools
${MAKE} PREFIX=${INSTALL_DIR}/usr install
find ${INSTALL_DIR} -empty -delete
override_dh_auto_build-indep: prepare-source install-source
@echo "--- Building Documentation"
# Create logo first, before generating documentation
${MAKE} -C doc/pasdoc/logo
${MAKE} -C doc/pasdoc ${DOCTYPE}
# pasdoc create a jquery file, but we link from jquery instead
${RM} doc/reference/tipuesearch/jquery.min.js
override_dh_auto_install-indep: install-source
override_dh_installdocs:
dh_installdocs -X.in
override_dh_install:
# tmp/tmp is used for the testsuite
dh_install -Xtmp/tmp/
override_dh_compress-indep:
dh_compress -X.pdf
override_dh_gencontrol:
dh_gencontrol -- -V"dejavu:version=$$(dpkg-query --show fonts-dejavu | awk '{print $$2}')"
.PHONY:prepare-source install-source
|