| 1 | #!/usr/bin/make -f |
| 2 | #export DH_VERBOSE=1 |
| 3 | |
| 4 | export DEB_BUILD_MAINT_OPTIONS=hardening=+all |
| 5 | export LC_ALL=C.UTF-8 |
| 6 | export TZ=UTC |
| 7 | |
| 8 | DEB_CFLAGS_MAINT_APPEND := \ |
| 9 | -Wno-misleading-indentation \ |
| 10 | -Wno-unused \ |
| 11 | -fsigned-char \ |
| 12 | $(NULL) |
| 13 | |
| 14 | include /usr/share/dpkg/default.mk |
| 15 | |
| 16 | %: |
| 17 | dh $@ |
| 18 | |
| 19 | ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) |
| 20 | TARGET = release |
| 21 | else |
| 22 | TARGET = debug |
| 23 | endif |
| 24 | |
| 25 | export Q3ARCH := $(shell /usr/share/ioquake3/q3arch arch ${DEB_HOST_GNU_CPU} ${DEB_HOST_GNU_SYSTEM}) |
| 26 | |
| 27 | common_options = \ |
| 28 | V=1 \ |
| 29 | BUILD_DIR=build \ |
| 30 | BUILD_STANDALONE=1 \ |
| 31 | USE_CODEC_VORBIS=1 \ |
| 32 | USE_CURL=1 \ |
| 33 | USE_CURL_DLOPEN=0 \ |
| 34 | USE_OPENAL=1 \ |
| 35 | USE_OPENAL_DLOPEN=0 \ |
| 36 | USE_VOIP=1 \ |
| 37 | USE_INTERNAL_SPEEX=0 \ |
| 38 | USE_INTERNAL_ZLIB=0 \ |
| 39 | USE_LOCAL_HEADERS=0 \ |
| 40 | $(shell /usr/share/ioquake3/q3arch make ${DEB_HOST_GNU_CPU} ${DEB_HOST_GNU_SYSTEM}) \ |
| 41 | SDL_CFLAGS= \ |
| 42 | BUILD_CLIENT=0 \ |
| 43 | BUILD_SERVER=0 \ |
| 44 | BUILD_GAME_SO=1 \ |
| 45 | CROSS_COMPILING=1 \ |
| 46 | CFLAGS='$(filter-out -fPIE -pie,$(CFLAGS)) $(CPPFLAGS)' \ |
| 47 | LDFLAGS='$(filter-out -fPIE -pie,$(LDFLAGS)) -Wl,-z,defs' \ |
| 48 | $(NULL) |
| 49 | |
| 50 | GAME_OPTIONS = \ |
| 51 | B=build/0.8.8 \ |
| 52 | BD=build/0.8.8 \ |
| 53 | BR=build/0.8.8 \ |
| 54 | VERSION=$(DEB_VERSION)/$(DEB_VENDOR) \ |
| 55 | $(NULL) |
| 56 | |
| 57 | GAME_081_OPTIONS = \ |
| 58 | B=build/0.8.1-compat \ |
| 59 | BD=build/0.8.1-compat \ |
| 60 | BR=build/0.8.1-compat \ |
| 61 | OPENARENA_081_COMPATIBLE=1 \ |
| 62 | VERSION=$(DEB_VERSION)/$(DEB_VENDOR)/0.8.1-compat \ |
| 63 | $(NULL) |
| 64 | |
| 65 | # We do a separate build for the server. It's actually the same, but with |
| 66 | # the version marking changed, so that it isn't identical to the one in |
| 67 | # openarena; this means its build-ID will be different, so its detatched |
| 68 | # debug symbols don't collide with the ones for the client. |
| 69 | GAME_SERVER_OPTIONS = \ |
| 70 | B=build/server \ |
| 71 | BD=build/server \ |
| 72 | BR=build/server \ |
| 73 | VERSION=$(DEB_VERSION)/$(DEB_VENDOR)/server \ |
| 74 | $(NULL) |
| 75 | |
| 76 | override_dh_auto_build: |
| 77 | mkdir -p build |
| 78 | echo '*' > build/.gitignore |
| 79 | dh_auto_build -- $(common_options) $(GAME_OPTIONS) $(TARGET) |
| 80 | dh_auto_build -- $(common_options) $(GAME_081_OPTIONS) $(TARGET) |
| 81 | dh_auto_build -- $(common_options) $(GAME_SERVER_OPTIONS) $(TARGET) |
| 82 | sed \ |
| 83 | -e 's!@IOQ3BINARY@!ioquake3!' \ |
| 84 | -e 's!@IOQ3SELF@!openarena!' \ |
| 85 | -e 's!@IOQ3ROLE@!client!' \ |
| 86 | -e 's!@FS_BASEPATH@!/usr/lib/openarena!' \ |
| 87 | < debian/scripts/openarena.in > debian/scripts/openarena |
| 88 | sed \ |
| 89 | -e 's!@IOQ3BINARY@!ioq3ded!' \ |
| 90 | -e 's!@IOQ3SELF@!openarena-server!' \ |
| 91 | -e 's!@IOQ3ROLE@!server!' \ |
| 92 | -e 's!@FS_BASEPATH@!/usr/lib/openarena-server!' \ |
| 93 | < debian/scripts/openarena.in > debian/scripts/openarena-server |
| 94 | chmod +x debian/scripts/openarena |
| 95 | chmod +x debian/scripts/openarena-server |
| 96 | |
| 97 | override_dh_clean: |
| 98 | dh_clean --exclude README-0.8.8~ |
| 99 | |
| 100 | override_dh_auto_clean: |
| 101 | rm -f build-stamp |
| 102 | rm -rf build |
| 103 | rm -f debian/scripts/openarena |
| 104 | rm -f debian/scripts/openarena-server |
| 105 | |
| 106 | override_dh_auto_install: DESTDIR = debian/tmp |
| 107 | override_dh_auto_install: |
| 108 | install -d $(DESTDIR)/usr/games |
| 109 | install -d $(DESTDIR)/usr/lib/openarena/baseoa/pak0/ |
| 110 | install -d $(DESTDIR)/usr/lib/openarena/baseoa/pak6-patch085/ |
| 111 | install -d $(DESTDIR)/usr/lib/openarena/baseoa/pak6-patch088/ |
| 112 | install -d $(DESTDIR)/usr/lib/openarena/missionpack/ |
| 113 | install -d $(DESTDIR)/usr/lib/openarena-server/baseoa/ |
| 114 | install -d $(DESTDIR)/usr/lib/openarena-server/missionpack/ |
| 115 | # The client currently needs two builds: |
| 116 | # * one compatible with OA 0.8.1 pure servers |
| 117 | # * one compatible with OA 0.8.5 and 0.8.8 pure servers |
| 118 | # On impure servers, we default to the latest. |
| 119 | install -m644 build/0.8.1-compat/baseq3/*.so \ |
| 120 | $(DESTDIR)/usr/lib/openarena/baseoa/pak0/ |
| 121 | install -m644 build/0.8.8/baseq3/*.so \ |
| 122 | $(DESTDIR)/usr/lib/openarena/baseoa/pak6-patch088 |
| 123 | ( cd $(DESTDIR)/usr/lib/openarena/baseoa/pak6-patch085 && \ |
| 124 | ln -s ../pak6-patch088/*.so . ) |
| 125 | ( cd $(DESTDIR)/usr/lib/openarena/baseoa && \ |
| 126 | ln -s pak6-patch088/*.so . ) |
| 127 | # The "mission pack" doesn't currently have incompatible versions so |
| 128 | # just use the latest |
| 129 | install -m644 build/0.8.8/missionpack/*.so\ |
| 130 | $(DESTDIR)/usr/lib/openarena/missionpack/ |
| 131 | # The server only needs the latest version, since it's the server |
| 132 | # that determines which version clients are expected to be |
| 133 | # compatible with |
| 134 | install -m644 build/server/baseq3/qagame*.so \ |
| 135 | $(DESTDIR)/usr/lib/openarena-server/baseoa/ |
| 136 | install -m644 build/server/missionpack/qagame*.so\ |
| 137 | $(DESTDIR)/usr/lib/openarena-server/missionpack/ |
| 138 | |
| 139 | # --------------------------------------------------------------------------- |
| 140 | |
| 141 | ORIG_SOURCE = openarena |
| 142 | ORIG_REL = 0.8.8 |
| 143 | ORIG_COPYRIGHT = $(dir $(firstword $(MAKEFILE_LIST)))/copyright |
| 144 | |
| 145 | .PHONY: get-orig-source |
| 146 | get-orig-source: |
| 147 | test ! -e get-orig-source |
| 148 | mkdir get-orig-source |
| 149 | if test -e ../oa-${ORIG_REL}.tar.bz2; then \ |
| 150 | cp ../oa-${ORIG_REL}.tar.bz2 get-orig-source/; \ |
| 151 | else \ |
| 152 | wget -O get-orig-source/oa-${ORIG_REL}.tar.bz2 \ |
| 153 | http://files.poulsander.com/~poul19/public_files/oa/dev088/oa-${ORIG_REL}.tar.bz2; \ |
| 154 | fi |
| 155 | test "`sha256sum -b get-orig-source/oa-${ORIG_REL}.tar.bz2`" = \ |
| 156 | "47fed4ea740278aa970538fc15819a4f6b8631eda380431ba09eb1b31ecbe5ad *get-orig-source/oa-${ORIG_REL}.tar.bz2" |
| 157 | mk-origtargz \ |
| 158 | --package=${ORIG_SOURCE} \ |
| 159 | --copyright-file=${ORIG_COPYRIGHT} \ |
| 160 | --repack \ |
| 161 | --repack-suffix=+dfsg \ |
| 162 | --compression xz \ |
| 163 | --directory ${CURDIR} \ |
| 164 | --version ${ORIG_REL} \ |
| 165 | get-orig-source/oa-${ORIG_REL}.tar.bz2 |
| 166 | rm -fr get-orig-source |
| 167 | |
| 168 | # to be invoked from a git checkout, tarball ends up in ../build-area |
| 169 | maintainer-get-orig-source: |
| 170 | $(MAKE) -f debian/rules get-orig-source |
| 171 | mv -i -v ${ORIG_SOURCE}_${ORIG_REL}+dfsg.orig.tar.xz ../build-area/ |
| 172 | @echo "try using:" |
| 173 | @echo "gbp import-orig ../build-area/${ORIG_SOURCE}_${ORIG_REL}+dfsg.orig.tar.xz" |