| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
include /usr/share/dpkg/pkg-info.mk |
| 5 |
export DH_ALWAYS_EXCLUDE := COPYING:LICENSE |
| 6 |
export LANG:=C |
| 7 |
|
| 8 |
|
| 9 |
ifeq (${DEBDOCTYPE},) |
| 10 |
DOCTYPE=html |
| 11 |
|
| 12 |
CONVERTER=${DOCTYPE}docs |
| 13 |
else |
| 14 |
DOCTYPE=${DEBDOCTYPE} |
| 15 |
CONVERTER=${DOCTYPE}docs |
| 16 |
endif |
| 17 |
|
| 18 |
ifndef FPC |
| 19 |
FPC=/usr/bin/fpc |
| 20 |
endif |
| 21 |
|
| 22 |
FPCVER=$(shell ${FPC} -iV) |
| 23 |
|
| 24 |
CPU_TARGET?=$(shell ${FPC} -iTP) |
| 25 |
OS_TARGET?=$(shell ${FPC} -iTO) |
| 26 |
FPCTARGET=${CPU_TARGET}-${OS_TARGET} |
| 27 |
export CGE_VERSION=$(shell echo ${DEB_VERSION_UPSTREAM} | sed -e 's/^\([0-9\.]*\).*/\1/') |
| 28 |
DEB_BUILD=$(lastword $(subst -, ,${DEB_VERSION})) |
| 29 |
|
| 30 |
INSTALL_DIR=$(CURDIR)/debian/tmp |
| 31 |
CFG_DIR=${INSTALL_DIR}/etc/fpc-${FPCVER}.cfg.d |
| 32 |
LIB_PREFIX=${INSTALL_DIR}/usr/lib |
| 33 |
LIB_DIR=${LIB_PREFIX}/${DEB_SOURCE} |
| 34 |
SRC_DIR=$(CURDIR)/debian/src/${DEB_SOURCE}-${CGE_VERSION} |
| 35 |
TMP_DIR=${INSTALL_DIR}/tmp |
| 36 |
|
| 37 |
UNITS_DIR=${LIB_PREFIX}/${DEB_HOST_MULTIARCH}/${DEB_SOURCE}/fp-units/${FPCVER} |
| 38 |
|
| 39 |
|
| 40 |
BUILDOPTS=\ |
| 41 |
--compiler-option=@${CURDIR}/castle-fpc.cfg \ |
| 42 |
|
| 43 |
|
| 44 |
ifndef MKDIR |
| 45 |
MKDIR=mkdir -p |
| 46 |
endif |
| 47 |
ifndef CP |
| 48 |
CP=cp -Rfpl |
| 49 |
endif |
| 50 |
RM:=rm -rf |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
%: |
| 55 |
dh ${@} |
| 56 |
|
| 57 |
override_dh_auto_clean: |
| 58 |
${MAKE} clean |
| 59 |
$(MAKE) strip-precompiled-libraries |
| 60 |
dh_auto_clean |
| 61 |
|
| 62 |
|
| 63 |
[ ! $$(which fp-fix-timestamps) ] || fp-fix-timestamps check |
| 64 |
|
| 65 |
prepare-source: prepare-source-stamp |
| 66 |
prepare-source-stamp: |
| 67 |
|
| 68 |
polute |
| 69 |
${MKDIR} ${TMP_DIR} |
| 70 |
${FPC} -FE${TMP_DIR} @castle-fpc.cfg \ |
| 71 |
-otexture-font-to-pascal \ |
| 72 |
tools/texture-font-to-pascal/texture_font_to_pascal.lpr |
| 73 |
cd src/fonts ; PATH=${PATH}:${TMP_DIR} ./mk_fonts.sh /usr/share/fonts/truetype/dejavu |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
for pngfile in $$(grep \\\.png\$$ debian/clean) ; do convert -layers flatten -background transparent $${pngfile%.png}.xcf $${pngfile} ; done |
| 78 |
|
| 79 |
${FPC} -FE${TMP_DIR} -dRELEASE @castle-fpc.cfg \ |
| 80 |
-oimage-to-pascal \ |
| 81 |
tools/image-to-pascal/image_to_pascal.lpr |
| 82 |
|
| 83 |
PATH=${TMP_DIR} ${MAKE} -C src/ui/gui-images all |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
${FPC} -FE${TMP_DIR} -dRELEASE @castle-fpc.cfg \ |
| 88 |
-Futools/internal/x3d-nodes-to-pascal/code \ |
| 89 |
-ox3d-nodes-to-pascal \ |
| 90 |
tools/internal/x3d-nodes-to-pascal/x3d_nodes_to_pascal.lpr |
| 91 |
cd tools/internal/x3d-nodes-to-pascal/ && \ |
| 92 |
PATH=${TMP_DIR} x3d-nodes-to-pascal \ |
| 93 |
--input-path nodes-specification/ \ |
| 94 |
--output-path ../../../src/scene/x3d/auto_generated_node_helpers/ |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
touch --no-dereference --date="@$${SOURCE_DATE_EPOCH}" \ |
| 102 |
src/scene/x3d/auto_generated_node_helpers/*.inc \ |
| 103 |
src/fonts/castletexturefont_*.pas \ |
| 104 |
src/ui/castlecontrols_*.inc |
| 105 |
|
| 106 |
fp-fix-timestamps touch |
| 107 |
|
| 108 |
touch prepare-source-stamp |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
install-source: install-source-stamp |
| 114 |
install-source-stamp: |
| 115 |
@echo "--- Copying the source code" |
| 116 |
dh_testdir |
| 117 |
${MKDIR} ${SRC_DIR} |
| 118 |
${CP} -t ${SRC_DIR} \ |
| 119 |
$(CURDIR)/src/* |
| 120 |
|
| 121 |
find ${SRC_DIR} -name '*.a' -o -name '*.o' -o -name '*.obj' -delete |
| 122 |
|
| 123 |
find $(SRC_DIR) -name '*.bmp' -o -name '*.pas' -exec chmod 644 '{}' ';' |
| 124 |
|
| 125 |
find ${SRC_DIR} -empty -delete |
| 126 |
touch install-source-stamp |
| 127 |
|
| 128 |
override_dh_auto_build-arch: prepare-source install-source |
| 129 |
|
| 130 |
${MAKE} build-using-fpmake tools CASTLE_ENGINE_TOOL_OPTIONS='$(BUILDOPTS)' |
| 131 |
|
| 132 |
${MAKE} -C doc/man/man1 |
| 133 |
|
| 134 |
override_dh_auto_install-arch: |
| 135 |
|
| 136 |
${MKDIR} ${UNITS_DIR} |
| 137 |
${CP} -t ${UNITS_DIR} units/${FPCTARGET}/* |
| 138 |
|
| 139 |
for package in $$(find * -name '*.lpk') ; \ |
| 140 |
do \ |
| 141 |
pkgDir=$$(dirname "${LIB_DIR}/$${package}") ; \ |
| 142 |
${MKDIR} "$${pkgDir}" ; \ |
| 143 |
sed -e 's@\(\W*\)<CompilerOptions>.*@\1<AutoUpdate Value="Manually"/>\n&@' \ |
| 144 |
-e "s@\.\./src/@$$(relpath ${SRC_DIR} $${pkgDir})/@g" \ |
| 145 |
-e "s@\(\W*\)<UnitOutputDirectory .*@<UnitOutputDirectory Value=\"$$(relpath ${UNITS_DIR} $${pkgDir})\"/>@" \ |
| 146 |
"$${package}" > "${LIB_DIR}/$${package}" ; \ |
| 147 |
done |
| 148 |
|
| 149 |
${MAKE} PREFIX=${INSTALL_DIR}/usr install |
| 150 |
configration |
| 151 |
${MKDIR} ${CFG_DIR} |
| 152 |
${CP} debian/castle-game-engine.cfg ${CFG_DIR}/castle-game-engine |
| 153 |
|
| 154 |
find ${INSTALL_DIR} -empty -delete |
| 155 |
fpc-depends |
| 156 |
|
| 157 |
override_dh_auto_build-indep: prepare-source install-source |
| 158 |
@echo "--- Building Documentation" |
| 159 |
|
| 160 |
${MAKE} -C doc/pasdoc/logo |
| 161 |
${MAKE} -C doc/pasdoc ${DOCTYPE} |
| 162 |
|
| 163 |
${RM} doc/reference/tipuesearch/jquery.min.js |
| 164 |
|
| 165 |
${RM} doc/reference/castle-engine-website-base/node_modules/slick-carousel/.npmignore |
| 166 |
|
| 167 |
${RM} tools/contrib/x86_64-win64 |
| 168 |
|
| 169 |
override_dh_auto_install-indep: install-source |
| 170 |
|
| 171 |
execute_before_dh_debputy: |
| 172 |
mkdir -p ${INSTALL_DIR}/packages |
| 173 |
echo 'If you are looking for CGE documentation, please install the package named' > ${INSTALL_DIR}/packages/README.txt |
| 174 |
echo 'castle-game-engine-doc.' >> ${INSTALL_DIR}/packages/README.txt |
| 175 |
|
| 176 |
.PHONY:prepare-source install-source |
| 177 |
|
| 178 |
lintian: |
| 179 |
lintian -I -i ../${DEB_SOURCE}_${DEB_VERSION}.dsc |