| 1 | #!/usr/bin/make -f |
| 2 | |
| 3 | # Uncomment this to turn on verbose mode. |
| 4 | #export DH_VERBOSE=1 |
| 5 | |
| 6 | export TZscip-makefile . . . TZ.=UTC |
| 7 | |
| 8 | include /usr/share/dpkg/default.mk |
| 9 | |
| 10 | %scip-makefile . . . `%`/: |
| 11 | dh $@scip-makefile . . . `@`. |
| 12 | |
| 13 | paksscip-makefile . . . paks. := $(shell cat debian/$(DEB_SOURCE).paks) |
| 14 | |
| 15 | # We cannot apply dh_strip_nondeterminism to the PK3 files because |
| 16 | # it would sort the files inside the archive, and the idTech3 engine |
| 17 | # is sensitive to order: an archive with re-ordered files is not |
| 18 | # considered network-compatible. The order of files is arbitrary but |
| 19 | # deterministic, and is chosen to match the arbitrary order that |
| 20 | # is present in upstream binary releases. |
| 21 | override_dh_strip_nondeterminismscip-makefile . . . override_dh_strip_nondeterminism/: |
| 22 | dh_strip_nondeterminism -X.pk3 |
| 23 | |
| 24 | override_dh_auto_buildscip-makefile . . . override_dh_auto_build/: $(patsubst %,build/%,$(scip-makefile . . . `$(patsubst %,build/%,$(paks))`/paksscip-makefile . . . paks.))scip-makefile . . . `$(patsubst %,build/%,$(paks))`/ |
| 25 | : |
| 26 | |
| 27 | debian/%.pk3.contents.rawscip-makefile . . . `debian/%.pk3.contents.raw`/: debian/%.pk3.contentsscip-makefile . . . `debian/%.pk3.contents`/ |
| 28 | sed -n -e 's/#.*//; /./p;' < $<scip-makefile . . . `<`. > $@scip-makefile . . . `@`. |
| 29 | |
| 30 | debian/%.pk3.filenamesscip-makefile . . . `debian/%.pk3.filenames`/: debian/%.pk3.contentsscip-makefile . . . `debian/%.pk3.contents`/ |
| 31 | sed -n -e 's/#.*//; s/.*\t//p;' < $<scip-makefile . . . `<`. > $@scip-makefile . . . `@`. |
| 32 | |
| 33 | debian/%.pk3.qvmsscip-makefile . . . `debian/%.pk3.qvms`/: debian/%.pk3.contentsscip-makefile . . . `debian/%.pk3.contents`/ |
| 34 | sed -n -e 's/#.*//; s/\.qvm$$//p;' < $<scip-makefile . . . `<`. > $@scip-makefile . . . `@`. |
| 35 | |
| 36 | build/%scip-makefile . . . `build/%`/: debian/%.pk3.qvmsscip-makefile . . . `debian/%.pk3.qvms`/ debian/%.pk3.filenamesscip-makefile . . . `debian/%.pk3.filenames`/ debian/%.pk3.contents.rawscip-makefile . . . `debian/%.pk3.contents.raw`/ |
| 37 | set -e; while read crc filename; do \ |
| 38 | test -f $*scip-makefile . . . `*`.-$$crc.qvm || \ |
| 39 | $(MAKEscip-makefile . . . MAKE.) -f debian/rules QVMPREFIX=$(*Fscip-makefile . . . `*F`.) QVMCRC=$$crc \ |
| 40 | debian/$(*Fscip-makefile . . . `*F`.)-$$crc.qvm; \ |
| 41 | install -d $*scip-makefile . . . `*`./vm; \ |
| 42 | install -v -m644 debian/$(*Fscip-makefile . . . `*F`.)-$$crc.qvm $*scip-makefile . . . `*`./$$filename.qvm; \ |
| 43 | touch --date='@$(SOURCE_DATE_EPOCH)' $*scip-makefile . . . `*`./$$filename.qvm; \ |
| 44 | touch --date='@$(SOURCE_DATE_EPOCH)' $*scip-makefile . . . `*`./vm; \ |
| 45 | done < debian/$*scip-makefile . . . `*`..pk3.qvms |
| 46 | rm -f $*scip-makefile . . . `*`..pk3 |
| 47 | ( set -e; cd $*scip-makefile . . . `*`.; while read crc filename; do \ |
| 48 | if test $$crc = directory; then \ |
| 49 | chmod 0755 "$$filename"; \ |
| 50 | else \ |
| 51 | chmod 0644 "$$filename"; \ |
| 52 | fi; \ |
| 53 | done ) < debian/$*scip-makefile . . . `*`..pk3.contents.raw |
| 54 | ( cd $*scip-makefile . . . `*`. && zip -X -o -q -9 $(CURDIRscip-makefile . . . CURDIR.)/$*scip-makefile . . . `*`..pk3 -@ ) < \ |
| 55 | debian/$*scip-makefile . . . `*`..pk3.filenames |
| 56 | |
| 57 | override_dh_auto_testscip-makefile . . . override_dh_auto_test/: $(patsubst %,check/%,$(scip-makefile . . . `$(patsubst %,check/%,$(paks))`/paksscip-makefile . . . paks.))scip-makefile . . . `$(patsubst %,check/%,$(paks))`/ |
| 58 | : |
| 59 | |
| 60 | check/pak0scip-makefile . . . `check/pak0`/: build/pak0scip-makefile . . . `build/pak0`/ |
| 61 | grep "NTVEpak0" pak0/vm/cgame.qvm |
| 62 | grep "NTVEpak0" pak0/vm/qagame.qvm |
| 63 | grep "NTVEpak0" pak0/vm/ui.qvm |
| 64 | |
| 65 | check/mp-pak0scip-makefile . . . `check/mp-pak0`/: build/mp-pak0scip-makefile . . . `build/mp-pak0`/ |
| 66 | grep "NTVEmp-pak0" mp-pak0/vm/cgame.qvm |
| 67 | grep "NTVEmp-pak0" mp-pak0/vm/qagame.qvm |
| 68 | grep "NTVEmp-pak0" mp-pak0/vm/ui.qvm |
| 69 | |
| 70 | check/pak6-patch085scip-makefile . . . `check/pak6-patch085`/: build/pak6-patch085scip-makefile . . . `build/pak6-patch085`/ |
| 71 | grep "NTVEpak6-patch085" pak6-patch085/vm/cgame.qvm |
| 72 | grep "NTVEpak6-patch085" pak6-patch085/vm/qagame.qvm |
| 73 | grep "NTVEpak6-patch085" pak6-patch085/vm/ui.qvm |
| 74 | |
| 75 | check/pak6-patch088scip-makefile . . . `check/pak6-patch088`/: build/pak6-patch088scip-makefile . . . `build/pak6-patch088`/ |
| 76 | grep "NTVEpak6-patch088" pak6-patch088/vm/cgame.qvm |
| 77 | grep "NTVEpak6-patch088" pak6-patch088/vm/qagame.qvm |
| 78 | grep "NTVEpak6-patch088" pak6-patch088/vm/ui.qvm |
| 79 | |
| 80 | # otherwise there's nothing to check |
| 81 | check/%scip-makefile . . . `check/%`/: build/%scip-makefile . . . `build/%`/ |
| 82 | : |
| 83 | |
| 84 | # check that the PK3s are still compatible (do this as late as |
| 85 | # possible so that they aren't going to be modified further) |
| 86 | override_dh_builddebscip-makefile . . . override_dh_builddeb/: $(patsubst %,check-compat/%,$(scip-makefile . . . `$(patsubst %,check-compat/%,$(paks))`/paksscip-makefile . . . paks.))scip-makefile . . . `$(patsubst %,check-compat/%,$(paks))`/ |
| 87 | dh_builddeb |
| 88 | |
| 89 | check-compat/%scip-makefile . . . `check-compat/%`/: debian/%.pk3.contents.rawscip-makefile . . . `debian/%.pk3.contents.raw`/ |
| 90 | perl debian/list-pk3.pl \ |
| 91 | debian/*/usr/share/games/openarena/*/$*scip-makefile . . . `*`..pk3 | \ |
| 92 | sed -n -e 's/#.*//; /./p' | \ |
| 93 | diff -u debian/$*scip-makefile . . . `*`..pk3.contents.raw - |
| 94 | |
| 95 | build-indepscip-makefile . . . build-indep/: debian/openarena-088-data.README.Debianscip-makefile . . . `debian/openarena-088-data.README.Debian`/ |
| 96 | debian/openarena-088-data.README.Debianscip-makefile . . . `debian/openarena-088-data.README.Debian`/: debian/qvms.README.Debianscip-makefile . . . `debian/qvms.README.Debian`/ |
| 97 | install -m644 $<scip-makefile . . . `<`. $@scip-makefile . . . `@`. |
| 98 | |
| 99 | build-indepscip-makefile . . . build-indep/: debian/openarena-085-data.README.Debianscip-makefile . . . `debian/openarena-085-data.README.Debian`/ |
| 100 | debian/openarena-085-data.README.Debianscip-makefile . . . `debian/openarena-085-data.README.Debian`/: debian/qvms.README.Debianscip-makefile . . . `debian/qvms.README.Debian`/ |
| 101 | install -m644 $<scip-makefile . . . `<`. $@scip-makefile . . . `@`. |
| 102 | |
| 103 | build-indepscip-makefile . . . build-indep/: debian/openarena-data.README.Debianscip-makefile . . . `debian/openarena-data.README.Debian`/ |
| 104 | debian/openarena-data.README.Debianscip-makefile . . . `debian/openarena-data.README.Debian`/: debian/qvms.README.Debianscip-makefile . . . `debian/qvms.README.Debian`/ |
| 105 | install -m644 $<scip-makefile . . . `<`. $@scip-makefile . . . `@`. |
| 106 | |
| 107 | ifeq ($(filter-out openarena-oacmp1,$(DEB_SOURCE)),) |
| 108 | build-indepscip-makefile . . . build-indep/: oacmp-volume1-v3/docs/READMEscip-makefile . . . `oacmp-volume1-v3/docs/README`/ |
| 109 | oacmp-volume1-v3/docs/READMEscip-makefile . . . `oacmp-volume1-v3/docs/README`/: oacmp-volume1-v3/docs/OACMP-Readme.txtscip-makefile . . . `oacmp-volume1-v3/docs/OACMP-Readme.txt`/ |
| 110 | install -m644 $<scip-makefile . . . `<`. $@scip-makefile . . . `@`. |
| 111 | endif |
| 112 | |
| 113 | # order-only dependency: once we've generated it, no need to waste time |
| 114 | # generating it again, it'll come out the same |
| 115 | debian/scip-makefile . . . `debian/$(QVMPREFIX)-$(QVMCRC).qvm`/$(QVMPREFIX)-scip-makefile . . . `debian/$(QVMPREFIX)-$(QVMCRC).qvm`/$(QVMCRC).qvmscip-makefile . . . `debian/$(QVMPREFIX)-$(QVMCRC).qvm`/: |scip-makefile . . . `|`/ debian/qvmbrutescip-makefile . . . `debian/qvmbrute`/ |
| 116 | ./debian/qvmbrute 0x$(QVMCRC) $@scip-makefile . . . `@`. $(QVMPREFIX) |
| 117 | |
| 118 | debian/qvmbrutescip-makefile . . . `debian/qvmbrute`/: |scip-makefile . . . `|`/ debian/qvmbrute.cscip-makefile . . . `debian/qvmbrute.c`/ |
| 119 | $(DEB_BUILD_GNU_TYPE)-gcc \ |
| 120 | $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -Wall \ |
| 121 | -o debian/qvmbrute debian/qvmbrute.c \ |
| 122 | $(LDFLAGS_FOR_BUILD) -lz |
| 123 | |
| 124 | tarballscip-makefile . . . tarball. := $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz |
| 125 | tardirscip-makefile . . . tardir. := $(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM).orig |
| 126 | |
| 127 | ifeq ($(filter-out openarena-oacmp1,$(DEB_SOURCE)),) |
| 128 | sourcesscip-makefile . . . sources. = oacmp-volume1-v3 |
| 129 | import-origscip-makefile . . . import-orig/: pre-import-origscip-makefile . . . pre-import-orig/ $(patsubst %,import-orig-zip/%,$(scip-makefile . . . `$(patsubst %,import-orig-zip/%,$(sources))`/sourcesscip-makefile . . . sources.))scip-makefile . . . `$(patsubst %,import-orig-zip/%,$(sources))`/ |
| 130 | : |
| 131 | else |
| 132 | sourcesscip-makefile . . . sources. = source |
| 133 | import-origscip-makefile . . . import-orig/: pre-import-origscip-makefile . . . pre-import-orig/ $(patsubst %,import-orig-pk3/%,$(scip-makefile . . . `$(patsubst %,import-orig-pk3/%,$(paks))`/paksscip-makefile . . . paks.))scip-makefile . . . `$(patsubst %,import-orig-pk3/%,$(paks))`/ |
| 134 | : |
| 135 | endif |
| 136 | |
| 137 | pre-import-origscip-makefile . . . pre-import-orig/: |
| 138 | rm -rf $(sourcesscip-makefile . . . sources.) |
| 139 | |
| 140 | import-orig-pk3/%scip-makefile . . . `import-orig-pk3/%`/: pre-import-origscip-makefile . . . pre-import-orig/ |
| 141 | @if ! test -f $*scip-makefile . . . `*`..pk3; then \ |
| 142 | echo "Copy upstream pk3 file to $*scip-makefile . . . `*`..pk3";\ |
| 143 | exit 1;\ |
| 144 | fi |
| 145 | rm -f debian/$*scip-makefile . . . `*`..pk3.contents |
| 146 | rm -rf ./$*scip-makefile . . . `*`. |
| 147 | install -d $*scip-makefile . . . `*`. |
| 148 | perl debian/list-pk3.pl $*scip-makefile . . . `*`..pk3 > debian/$*scip-makefile . . . `*`..pk3.contents |
| 149 | unzip -q $*scip-makefile . . . `*`..pk3 -x '*.qvm' '../*' -d $*scip-makefile . . . `*`. |
| 150 | set -e && if test mp-pak0 = $*scip-makefile . . . `*`.; then \ |
| 151 | unzip -o -j mp-pak0.pk3 ../COPYING ../CREDITS; \ |
| 152 | fi |
| 153 | # r901 is 0.8.1; r931 is 0.8.5 (despite the commit message) |
| 154 | # r947 is 0.8.8 |
| 155 | # source/assets/textures/trak/ are not GPL-compatible |
| 156 | set -e; for r in 901 931 947; do \ |
| 157 | if ! test -e debian/$*scip-makefile . . . `*`..svn$$r; then \ |
| 158 | continue; \ |
| 159 | fi; \ |
| 160 | install -d debian/svn-r$$r/source; \ |
| 161 | test -d debian/svn-r$$r/source/assets || svn export -r$$r \ |
| 162 | https://openarena.ws/svn/source/assets \ |
| 163 | debian/svn-r$$r/source/assets; \ |
| 164 | rm -rf debian/svn-r$$r/source/assets/textures/trak/; \ |
| 165 | while read s; do \ |
| 166 | rsync --link-dest=debian/svn-r$$r \ |
| 167 | --files-from=debian/$*scip-makefile . . . `*`..svn$$r -r \ |
| 168 | debian/svn-r$$r/ ./; \ |
| 169 | done < debian/$*scip-makefile . . . `*`..svn$$r; \ |
| 170 | done |
| 171 | |
| 172 | import-orig-zip/%scip-makefile . . . `import-orig-zip/%`/: |
| 173 | @if ! test -f $*scip-makefile . . . `*`..zip; then \ |
| 174 | echo "Copy upstream download to $*scip-makefile . . . `*`..zip";\ |
| 175 | exit 1;\ |
| 176 | fi |
| 177 | unzip $*scip-makefile . . . `*`..zip -d $*scip-makefile . . . `*`. |
| 178 | mv $*scip-makefile . . . `*`./*/*.pk3 . |
| 179 | |
| 180 | export-origscip-makefile . . . export-orig/: |
| 181 | rm -rf $(tardirscip-makefile . . . tardir.) |
| 182 | install -d $(tardirscip-makefile . . . tardir.) |
| 183 | set -e && for x in $(paksscip-makefile . . . paks.) $(sourcesscip-makefile . . . sources.); do \ |
| 184 | cp -al $$x $(tardirscip-makefile . . . tardir.)/$$x; \ |
| 185 | done |
| 186 | ifneq ($(filter-out openarena-oacmp1,$(DEB_SOURCE)),) |
| 187 | install -m644 CHANGES COPYING CREDITS CREDITS-0.8.5 CREDITS-0.8.8 LINUXNOTES README WENEED readme_085.txt readme_088.txt $(tardirscip-makefile . . . tardir.) |
| 188 | endif |
| 189 | tar -Jvcf ../$(tarballscip-makefile . . . tarball.) $(tardirscip-makefile . . . tardir.) |
| 190 | rm -rf $(tardirscip-makefile . . . tardir.) |