summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 0888c6e413517d2a22ebca63fa28c29b11967c13 (plain)
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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net>
# Maintainer (Arch): Kyle Keen <keenerd@gmail.com>

# # I maintain this because:
# Arch version lacks additional optimization and hardening flags
# Arch version has non-functional desktop file
# Arch version lacks the MSX++UnDeadPeopleEdition tileset
# Arch version lacks the @ soundpack
# Arch version lacks the CO.AG musicpack

pkgbase=cataclysm-dda
pkgname=(cataclysm-dda cataclysm-dda-tiles)
pkgname=cataclysm-dda
pkgver=0.G
_pkgver=0.G
pkgrel=1
pkgdesc="A post-apocalyptic roguelike."
#url="http://cataclysmrl.blogspot.com/"
#url="http://www.cataclysm.glyphgryph.com/"
#url="http://en.cataclysmdda.com/"
url="https://cataclysmdda.org/"
arch=('x86_64' 'aarch64')
license=("CCPL")
options=('lto')
depends=('ncurses' 'hicolor-icon-theme' 'gettext')
makedepends=('sdl2_image' 'sdl2_ttf' 'sdl2_mixer' 'freetype2' 'astyle')
#source=("$pkgname-$_pkgver.tar.gz::https://github.com/CleverRaven/Cataclysm-DDA/archive/refs/tags/cdda-experimental-$_pkgver.tar.gz"
source=("$pkgname-$_pkgver.tar.gz::https://github.com/CleverRaven/Cataclysm-DDA/archive/refs/tags/$_pkgver.tar.gz"
#source=("$pkgname-$_pkgver.tar.gz::https://github.com/CleverRaven/Cataclysm-DDA/archive/$_pkgver.tar.gz"
        "cataclysm-dda.desktop"
        "cataclysm-dda-tiles.desktop"

        "ammo-01_inconsistent-ammo-names.patch"
        "ammo-02_fix-20x66mm-loudness.patch"
        "ammo-03_fix-reloaded-50bmg.patch"
        "ammo-10_ammo-order-fix.patch"
        "ammo-20_ammo-typos.patch"

        "armor-01_ankle-ammo-pouch-is-not-a-backpack.patch"
        "armor-02_fix-survivor-fingerless-gloves-warmth.patch"

        "bionics-01_npc-can-use-more-bionics.patch"

        "foods-01_fix-food-materials.patch"
        "foods-03_fix-mutant-bad-taste.patch"

        "itemgroups-01_hk46-is-milspec.patch"
        "itemgroups-03_fix-shelter-batteries.patch"

        "meds-01_antibiotics-unhealthy.patch"

        "mission-01_typos.patch"

        "mutations-02_fix-evac3-background-visible.patch"

        "npc-08_nurse-takes-more-meds.patch"
        "npc-09_broker-takes-more-foods.patch"
        "npc-11_npcs-reload-gas-mask.patch"
        "npc-20_dialogue-fixes.patch"

        "recipes-01_4570-dragon-can-be-dismantled.patch"

        "terrain-04_lumbermill-gasoline-not-spilled.patch"
        "terrain-08_more-military-base-overmap.patch"
        "terrain-11_clean-up-map-extras.patch"

        "tools-04_normalize-drone-volume.patch"

        "vehicles-01_portable-generator-engine.patch"
        "vehicles-02_fix-fbi-car-name.patch"
        "vehicles-03_black-box-can-be-installed.patch"

        "etc-01_fix-rubbersplosion.patch"

        "src-01_radio-can-use-ups.patch"
        "src-02_ammo-loudness-ap-times-2.patch"
        "src-03_allow-bio-firestarter-on-smoker.patch"
        "src-04_stop-non-faction-npc-sleep-depirvation.patch"
        "src-05_stop-non-faction-npc-malnourishment.patch"
        "src-06_stop-sleeping-on-tables.patch"
        "src-07_allow-hacker-laptop.patch"
        "src-09_npc-eat-from-further-camp.patch"
        "src-11_remove-legacy-recruiting-penalty.patch"
        "src-12_fix-food-supply-calculations.patch"
        
        "vampirism.patch"

        "cataclysm-dda-tileset_undeadpeople.tar.xz::https://library.iserlohn-fortress.net/cataclysm-dda-tileset_undeadpeople.git/snapshot/cataclysm-dda-tileset_undeadpeople-master.tar.xz"
        "cataclysm-dda-mod_battle-maid-redone-tileset.tar.xz::https://library.iserlohn-fortress.net/cataclysm-dda-mod_battle-maid-redone-tileset.git/snapshot/cataclysm-dda-mod_battle-maid-redone-tileset-master.tar.xz"
        "cataclysm-dda-soundpack_jcsoundpack.tar.xz::https://library.iserlohn-fortress.net/cataclysm-dda-soundpack_jcsoundpack.git/snapshot/cataclysm-dda-soundpack_jcsoundpack-master.tar.xz"
        "cataclysm-dda-musicpack_coag-musicpack.tar.xz::https://library.iserlohn-fortress.net/cataclysm-dda-musicpack_coag-musicpack.git/snapshot/cataclysm-dda-musicpack_coag-musicpack-master.tar.xz"
        )
b2sums=('58b3e313d1aaae2d6a3b185904c35dda8fab2d37f99624be4661975772e9f08e94a97d8221f87fb0f27c7a4e1d1ab712811ec5067e63c92139ef36940d12efe6'
        '8cff87d80bf30b86f995f77a97cc1ddb7b809148d100f3c0d74e706fe59eac52de55710fb7aed1abd59836c05f2474c7d68455736aac4f229d1cdf806d7240a1'
        '8ffff827ed464af678497da5129eb69d3d1a4c6994bbcc00ef7f7b240cd04e7961c3c0ac52d6940252241406c04e647fac19c9327847afced33988eb15973ba8'
        '5dff40a22314227d603c278a8bf5ceb81e7e4b98fd8fa52edb17a006ee3dca84a1647d8d5ee5ba281c828a5b38b8b6ea2d22996c1c9b0b3ff816dd7f98bb1f14'
        '28ccb5aae3dd693ffc127c7dc0a038295591cdf5c6fde1b298f7ed0ab0010693bb29c0f01650927e8d993a3af3144ab261de60dd04dc0bc002cbd2ecea6761d2'
        'a6c7f8d9741e1e327aeb3fb03ca8a59cb7a311e7a687bf73048a5a1b50c490f6cde99433196628d1bdbd29c078242deb22694e1d9becec1c1da4fa0660464ba7'
        'cf8c0c45f9a222b9cfb1694d3d39ebd516b70327cc4567a899a64e43570b35961bf16183dfc891834ac37328dbde7810b5466f130a5b26032b487d6b2ddbc472'
        '2f5ca21814cc985c7c267d6747598704718b58680f4b94faa40c470070ba47abbf0ea69033763a0008b5234769c8b8358eed93f2c7c210ed7078b6669c2bd0c0'
        'b1383199d606fc3ed2cd40c1ec2e32aebc5edb69902ce0477b975bc57d3f6e43dde808ea5af0e326a19e5d61b50f2c1b59848d6505f7d42bb0189977feb6aa05'
        '0f835c251fd439eb6b620250035ae9b4ca6dc4f6df4db1fa59f9995ef0a1cbdf254c734c3db3a91a66ccdb0459fe36a080de6a809b978a23a499e0e48c39aec1'
        'c23b043ecd1fb750ddd88856e7b27856a33a7eea0c6ccb5b376d4961f07ca09d5eac2bbaf71d74932dec3eca9af6ed36ae4230765391bd186268b0cd4d4bb3f8'
        '2bce148423c87367312f2364c0101620b5da86c69acebd2c877f34788fe727f4ba43ad197f467aed750e17fec84e8445c226fdbbe3b7dea2135f2f4d3e0d6b64'
        'cca9a5d27768bf79a615aa9c019b081a0355e79e5417f6046bc331a7fc6079d2d0341dc8fd5d743a403c9baba554e47e497d56da36e55ecedecbb20b6fce05c9'
        'a68d2005f084cdeea2cfe11de6da1d3be07ab27da3dee567d1701bbb970f33d20b5e68ef66121c5821beffc96848ba5cbd02e316772f9327fceb7c496aa31ad4'
        '880cb1a343e2bdaa53c85fe82f8340d5e1c6d32313a99e50063781215ee848e00b16a2041ca5e4c5f765f275525886e9cd20262ed41ca44406697823169cc273'
        'f75b8058c6b081eb6e9b889795929f076b0a17736644926eb69df8ac7460c40b3148569f53c5fa2bb390d8a43b7f2a5115c6fffaae82cffa94ff317e257f3a48'
        '3b7276fe0e708830a09288bfb4076f0ff758ac3ed33711ccfdc93dda2f516630e1aeb5f6e67f417d71fad10eece05528ab4596d3912f657839c45e423df08313'
        '8a0e245ea0e92649987590e321cc227c0911836f47ac538783e8f0a28a32da8595c916f54d249ac1364283a70e0abc9d7a52331e392f3f5f736ffc0d2fcee789'
        'cf2074b5a143d0fcc0ade09c3bdebf0f15b67a8189f5ac0cf2085fdbf3279cbe50298915b756e08fed77f6dd949ae37df9e8fd0ef4399490c33ad8628c1e9b06'
        'fbfeff325c231e3a7f556bac9cd1e5d773a1da6e2494a312eec4c3fd76707330b46cd6653aaded770ab46809f45aeec54cdf10344fbc1e0258bf348dca3c7082'
        '4acf57f108ce331cb364408a63a414c39881b916c2d1c50e1e52ebe8e0b3df63596e9478caa2a7c3a06c59a07cbd80130e669662cc955aec2d32372fe0636771'
        '79202bbc83ff080b8fe6dfa3beb162d0bf33a642aedd8339948b19e0426d41ee96d12229b1830e09fd6566ea7c941824f7a654130b731fd33b75c0eec5441151'
        '9957d799eb495afe2505052171ca4835c3cf2dbd47197c983397a0b31caa1cf9ddb325ce365db62a7db5735f40e3951cc611ad3830788b8d3e94480ba586b171'
        '85aeb5920ee5879848be4057324153a077fe907bed527ed8f9b80a3c5ee1ef64786f63ee2999f5ba74e80a43e99ded3280ce27759c1f7b73259a6e2b5e584aa8'
        'e3302d903d053f25aa666d572f74a8bbd3b65dde40eedcbf46e537ceb2294ac22b3772087fce04c4a780c2f18e855179c6ddc8af12d72a89b82957ce09deb52f'
        '12d93f74de739ade2725983c9f6396111e2bb17f491c0de54f5e006e9b8dd5f5618afd63a1ea6fe2313cc5984157c0e5da62a60b429aa4f2d84751ecdba341f0'
        '877f36479ff9b8a0284360f1425d3574251c8a48482a824579500bc7da833adecc44c7ecd7d61d708722cf3ae70ba48c2af607c3cbba881720455901521c4889'
        'b5567d516b344ceb382bb0253e2b87c90ddc5379afb76a7d384aec0829a6d8a3de2a1f55740871cd286a8cfa23ca635ee9e3f81faa9839dc10fb209955b63c78'
        'a8d9075f3b3c46ec7b6d4d96c6e346c7bf79daa832026faba97846aad89456e18c51eadbfe00d3e6e36fcf2a1ff153de644d7553035fc5046fe6f4ac6de2c9e6'
        'b9d519e75c8fdd1522b7ce82055f1c8f5c05e2aaf45d77747e8e3924289322e68dc0ff11145ac9674015593c296eef06b36c5e86b6dc9fb21f2c130282c2b70b'
        '15f30d2dd4dc437aae2d9237d7ebc299a3b2d6752b111ef26462e165c3665a4aa825616b80e9927b9715ffb31aec25c2831a8015131d0e830e2cf6c9570526df'
        '06c5652eb2c70b8aba6d788415089b740c3510cd9c570838f656202ba2dc65d4f3289f6695413665de930e84fe287ef035ed8e83a0610a5a316e76a17442683a'
        '92cde696eec00e6758b58e73e8bc60ad1a73bb2a18d4fdfd24a19b5be715305a047943a02d94a9703c101ca0c769dbeb816f1f28809345bae0fec42fbc27bb34'
        '9fb6d2945184347e5b4f56f022d9b1b40559c1210edd91cb984d2c69e711dd297eab2a06d1e7d4008052fad658a9574ebd933083e7f8f3b3600b271593cbde15'
        'ce82294e480ad42f0001c799fd8131b60024b6097653f3c57564c75e54596616e376f0d7f1cf4e54d8c302a61ef164b4323f795bfa19b2c13ab9e927d37f1600'
        'f4d2d03d255a8b73fab16cb04e4f460eb74dd961610b14cc3ea99df4aa52bd024eb230432907e3845f585f4906ba8b1caa9d850666528cee22bada96481a3a21'
        '1e1c61c519805fe6c8c1d0fb3bf8c28f26823ffea20e4d92610117e81e50401d9eb02e05fb7135325580235bcc42be82921972467b416df5feb20a4742057b53'
        '8213031fc1e154648008109ae654db938689f01bca27b9a2009854dda7bc4d99e3bd4581f6cbd06e31a632cd8431be01d5e96fd69534670996fde9a1a39691f6'
        '66f65806ec968d4a9f571d0decb8f1c4f4b386aa3837b5c29713734c003676758e1e9ec8492adf2359847ac9e4ebf791c16dfee426272e90e42775379c5904fa'
        'ac2c5e03150bb0860b62d31c68304ad3ca5143a208bb58cd5bcc6beb924a6230cb3617a64bf902a4a69c5d25ce00de8398d5227d36efed4397652849467cfa4a'
        'f84197cbd2ed69f0107b136c118ab4608a2d3c70b112689f4dbc01399e8db3867c7673103e30dc9b24393f44438725a8ec82c7770fc7913aa39b61405ba3670b'
        '4e188cebde0ffd81624f2b9a2c9111aa41a82e3d80a7b80f143af70f0182cce6e0b58350807db2948414f1d655d42367263af67bd5ae707d3ada4010c924ccd1'
        'ec274f6809765a638ce17b7c89c442ea9c4232c8ab1e0f72be8d682da76ab6a10cf02c67af5438e7e7a1901af9d6c64f3c598b49052cdeb20932b26bc5e9ba82'
        'a56efdaae0344726debf5b74846edce8df7aa2357fbc7a05a3d369d1f457b02934a0d0ce2330072e03f1ac901e06e333c9393f795c761f8440307e7649ed5596'
        '14ef4cc6b05f8d9b0d6196c4b6f35cc8083bdf4820c19c320551158b47b570ee6b385f3d6b9888f614fb9d5325265feae810a2c5fff4a0deb42b01612bad6517'
        'b9309da09b165fb57e83f84e3584d2479bd3336ed86e181e5df2d27daa92bd55d03d7f3fc226f03696af5f0f32d8e0e7ecd26ae7e50eed0200d0b0feaad07efb')

prepare() {
  #cd "Cataclysm-DDA-cdda-experimental-${_pkgver}"
  cd "Cataclysm-DDA-$_pkgver"
  sed \
  -e 's/-Werror//' \
  -e 's/ncursesw5-config/ncursesw6-config/' \
  -e 's/shell git/shell false/' \
  -i Makefile

  # Disable default optimizations
  sed \
  -e 's/-Os/-O3/' \
  -e 's/-O0/-O3/' \
  -e 's/-Og/-O3/' \
  -e 's/CXXFLAGS += -ffast-math/#CXXFLAGS += -ffast-math/' \
  -i Makefile

  # Remove non-existent flags generating warnings
  sed \
  -e 's/-Wzero-as-null-pointer-constant \\/-Wzero-as-null-pointer-constant/' \
  -e 's/-Wno-range-loop-analysis/#-Wno-range-loop-analysis/' \
  -e 's/-Wno-unknown-warning-option/#-Wno-unknown-warning-option/' \
  -i Makefile

  # They forgot to adjust the version in 0.G!
  sed -i "s/0.F/0.G/" Makefile


  # # # Hotfixes
  #echo "Applying hotfixes"


  # # # Various fixes for bugs I came across
  # # Ammo fixes
  echo "Applying ammo fixes"
  # Fix mulitple inconsistent ammunition names and handloaded status.
  patch -Np1 -i "$srcdir"/ammo-01_inconsistent-ammo-names.patch

  # Set a fixed loudness for 20x66mm shotgun shells like that of other shotguns:
  # Other shotguns have fixed loudness to work around how the short range factors causes them to be far quieter than one would otherwise expect.
  patch -Np1 -i "$srcdir"/ammo-02_fix-20x66mm-loudness.patch

  # Change reloaded_50bmg to be based on 50bmg:
  # The id and description make it pretty clear that reloaded_50bmg is not supposed to be based on Match rounds.
  patch -Np1 -i "$srcdir"/ammo-03_fix-reloaded-50bmg.patch

  # Fix ammo ordering so as to not prevent those items being modded.
  # Having copy-from items occuring earlier in a json than the item being copied from prevents items based on it being modified.
  patch -Np1 -i "$srcdir"/ammo-10_ammo-order-fix.patch

  # Fix some rather serious typos in ammo descriptions:
  # Probably someone did a global replace and never audited the results. :/
  patch -Np1 -i "$srcdir"/ammo-20_ammo-typos.patch


  # # armor fixes
  echo "Applying armor fixes"
  # Fix Ankle Ammo Pouch to not look like a backpack:
  # SDG added a tile for ammo pouches to bypass this bug, but this fix still makes sense.
  patch -Np1 -i "$srcdir"/armor-01_ankle-ammo-pouch-is-not-a-backpack.patch

  # Fix fingerless survivor gloves losing base warmth:
  # They lose warmth already from the lack of coverage, no need to double up.
  patch -Np1 -i "$srcdir"/armor-02_fix-survivor-fingerless-gloves-warmth.patch


  # # bionics fixes
  echo "Applying bionic fixes"
  # Fix npc not being able to install some additional CBMs:
  #  ie, soporific inducer, gasoline fuel cell, enhanced hearing, surgical scalpels.
  patch -Np1 -i "$srcdir"/bionics-01_npc-can-use-more-bionics.patch


  # # faction fixes
  #echo "Applying faction fixes"


  # # faction camp fixes
  #echo "Applying faction camp fixes"


  # # food fixes
  echo "Applying food fixes"
  # Fix several foods not being marked as the correct material:
  # This prevents odd outcomes such as carnivores drinking almond/soy milk and eating peanut butter.
  patch -Np1 -i "$srcdir"/foods-01_fix-food-materials.patch

  # Fix several mutant components lacking the BAD_TASTE flag:
  # If raw mutant meat is flagged as disgusting, raw mutant fat must be just awful.
  patch -Np1 -i "$srcdir"/foods-03_fix-mutant-bad-taste.patch


  # # itemgroups fixes
  echo "Applying itemgroup fixes"
  # Stop police and SWAT carrying 4.6mm magazines despite having no compatible weapons:
  # The H&K UCP was removed from the base game some time ago.
  patch -Np1 -i "$srcdir"/itemgroups-01_hk46-is-milspec.patch

  # Fix items in unlooted, unused lockers and cabinets missing batteries:
  # They need to be marked as the battery contained inside the item.
  patch -Np1 -i "$srcdir"/itemgroups-03_fix-shelter-batteries.patch


  # # medicine fixes
  echo "Applying medicine fixes"
  # Add -4 health to antibiotics:
  # weak are -2, strong are -10, this feels like a nice middle ground.
  patch -Np1 -i "$srcdir"/meds-01_antibiotics-unhealthy.patch


  # # missions fixes
  echo "Applying mission fixes"
  # Fix Typos:
  # Foraging encounter has inconsistent monster references. Change all to cougar.
  patch -Np1 -i "$srcdir"/mission-01_typos.patch


  # # mutation fixes
  echo "Applying mutation fixes"
  # Fix Evacuee 3 background 3 being player visible:
  # It was missing "player_display": false
  patch -Np1 -i "$srcdir"/mutations-02_fix-evac3-background-visible.patch


  # # npc fixes
  echo "Applying NPC fixes"
  # Update the Tacoma Nurse to buy almost every non-dangerous, non-electrical, and non-expensive medicine.
  # Also remove acceptance for various tools that are not correctly taken, such as first aid kits.
  patch -Np1 -i "$srcdir"/npc-08_nurse-takes-more-meds.patch

  # Update the FMC broker to buy most preserved foods.
  # Also update the dialogue to specify that he buys more types.
  patch -Np1 -i "$srcdir"/npc-09_broker-takes-more-foods.patch

  # Fix npcs failing to reload activated gas masks:
  # Most masks lacked a "charges_per_use: 1" field, required for npcs to know they can reload it.
  # They still won't activate a fresh mask on their own though. :/
  patch -Np1 -i "$srcdir"/npc-11_npcs-reload-gas-mask.patch

  # Assorted typos in NPC dialogue.
  patch -Np1 -i "$srcdir"/npc-20_dialogue-fixes.patch


  # # recipe fixes
  echo "Applying recipe fixes"
  # Fix reloaded reloaded dragon shot not allowing dismantling when every other non-caseless round does.
  patch -Np1 -i "$srcdir"/recipes-01_4570-dragon-can-be-dismantled.patch


  # # terrain and overmap fixes
  echo "Applying terrain and overmap fixes"
  # Fix lumbermill gasoline being spilled instead of being inside the gas pump:
  # The gas pump was placed on top of a tile that didn't allow items inside, causing the gasoline to be shunted to the next valid one.
  patch -Np1 -i "$srcdir"/terrain-04_lumbermill-gasoline-not-spilled.patch

  # Expand the overmap tiles for the miltiary base to be less MMMM
  #patch -Np1 -i "$srcdir"/terrain-08_more-military-base-overmap.patch

  # Fix up several typos, missing symbols, odd naming, and many extras lacking map notes support in map extras:
  # More choice is better than less. You can disable undesired map notes in the map notes settings menu.
  patch -Np1 -i "$srcdir"/terrain-11_clean-up-map-extras.patch


  # # tool fixes
  echo "Applying tool fixes"
  # Normalize the manhack volumes to that of the base grenade/explosive:
  # I don't see how a c-4 manhack could be 1/4 the volume of a stick of c-4.
  # Grenade hacks were also thrice as big as the base grenade.
  patch -Np1 -i "$srcdir"/tools-04_normalize-drone-volume.patch


  # # vehicle fixes
  echo "Applying vehicle fixes"
  # Replace the portable generator twin engine with a large 1 cylinder:
  # This way it can actually function as is.
  patch -Np1 -i "$srcdir"/vehicles-01_portable-generator-engine.patch

  # Rename the FBI Car:
  # The stock name was clearly a typo of some sort.
  patch -Np1 -i "$srcdir"/vehicles-02_fix-fbi-car-name.patch

  # Fix the black box to actually be installable:
  # No tool provided screwing 3 and wrenching 3.
  patch -Np1 -i "$srcdir"/vehicles-03_black-box-can-be-installed.patch


  # # Uncategorized for now
  echo "Applying uncategorized fixes"
  # Fix rubber items dismantling into 10x item volume of rubber.
  patch -Np1 -i "$srcdir"/etc-01_fix-rubbersplosion.patch


  # # # Various other fixes for bugs I came across that modify src
  echo "Applying source code fixes"
  # Fix radio, e-ink reader music, tactical tonfa not working with UPS.
  #patch -Np1 -i "$srcdir"/src-01_radio-can-use-ups.patch

  # Fix ammo loudness mulitplying by six instead of two.
  patch -Np1 -i "$srcdir"/src-02_ammo-loudness-ap-times-2.patch

  # Fix smoker racks not accepting bionic firestarter.
  #patch -Np1 -i "$srcdir"/src-03_allow-bio-firestarter-on-smoker.patch

  # Fix Non-Player facton NPCs from becoming sleep deprived.
  patch -Np1 -i "$srcdir"/src-04_stop-non-faction-npc-sleep-depirvation.patch

  # Fix Non-Player facton NPCs from becoming malnourished.
  patch -Np1 -i "$srcdir"/src-05_stop-non-faction-npc-malnourishment.patch

  # Fix NPCs preferring tables to cots or woodstoves to the floor.
  patch -Np1 -i "$srcdir"/src-06_stop-sleeping-on-tables.patch

  # Allow the hacker_laptop to utilize the extra functions.
  patch -Np1 -i "$srcdir"/src-07_allow-hacker-laptop.patch

  # Allow npcs to pull food from the camp larder at the full range of tiles camp actions can be assigned from:
  # Should allow bases larger than 3x3 to have less food micromanagment for NPCs.
  patch -Np1 -i "$srcdir"/src-09_npc-eat-from-further-camp.patch

  # cur_level is set to -1 on all modern basecamps. Remove the recruiting penalty this legacy variable inadvertently induces.
  patch -Np1 -i "$srcdir"/src-11_remove-legacy-recruiting-penalty.patch

  # Fix faction food supply being calculated at 288 calories per person instead of 2500.
  patch -Np1 -i "$srcdir"/src-12_fix-food-supply-calculations.patch


  # # # Additional changes
  echo "Applying vampirism patch"
  # Add vampire mutation lines and modify a number of functions to facilitate these traits.
  patch -Np1 -i "$srcdir"/vampirism.patch

}

build() {
  #cd "Cataclysm-DDA-cdda-experimental-${_pkgver}"
  cd "Cataclysm-DDA-$_pkgver"

  #export CFLAGS="$CFLAGS -fPIE"
  export CXXFLAGS="$CXXFLAGS -fPIE"
  export LDFLAGS="$LDFLAGS,-pie"

  # Prevent segfaults when examine tile->search returns no results.
  #export CXXFLAGS="$(echo $CXXFLAGS | sed -i 's/-Wp,-D_GLIBCXX_ASSERTIONS//' - )" # No longer works
  export CXXFLAGS="$(echo $CXXFLAGS | sed 's/-Wp,-D_GLIBCXX_ASSERTIONS//')"
  #echo $CXXFLAGS

  # tests "ifdef TILES" so "TILES=0" will enable tiles!
  # DYNAMIC_LINKING appears to be a windows flag?
  make PREFIX=/usr RELEASE=1 USE_XDG_DIR=1 BACKTRACE=0 LOCALIZE=1 RUNTESTS=0 VERBOSE=1 PCH=0 LANGUAGES=all
  make PREFIX=/usr RELEASE=1 USE_XDG_DIR=1 BACKTRACE=0 LOCALIZE=1 RUNTESTS=0 VERBOSE=1 PCH=0 LANGUAGES=all TILES=1 SOUND=1
  ./lang/compile_mo.sh
}

package_cataclysm-dda() {
  #cd "Cataclysm-DDA-cdda-experimental-${_pkgver}"
  cd "Cataclysm-DDA-$_pkgver"

  make DESTDIR="$pkgdir" PREFIX="/usr" RELEASE=1 USE_HOME_DIR=1 LOCALIZE=1 RUNTESTS=0 VERBOSE=1 PCH=0 LANGUAGES=all install

  # Docs
  install -d "$pkgdir/usr/share/doc/cataclysm-dda"
  cp --reflink -r doc/* "$pkgdir/usr/share/doc/cataclysm-dda"
  # undo symlink
  rm "$pkgdir/usr/share/doc/cataclysm-dda/JSON_LOADING_ORDER.md"
  cp --reflink 'data/json/LOADING_ORDER.md' "$pkgdir/usr/share/doc/cataclysm-dda/JSON_LOADING_ORDER.md"+  # Manpage

  rm "$pkgdir/usr/share/doc/cataclysm-dda/"*.6
  install -Dm644 -t "$pkgdir/usr/share/man/man6" "doc/cataclysm.6"

  # License
  install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  # Languages
  cd lang/mo
  for i in *; do
    install -d "${pkgdir}/usr/share/locale/${i}/LC_MESSAGES"
    cp "${i}/LC_MESSAGES/cataclysm-dda.mo" "${pkgdir}/usr/share/locale/${i}/LC_MESSAGES"
  done

  # Help
  cd ./../..
  cp -r --no-preserve=ownership "./data/help" "${pkgdir}/usr/share/${pkgname}/"

#  install -Dm644 "${srcdir}/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
}

package_cataclysm-dda-tiles() {
  pkgdesc="A graphical post-apocalyptic roguelike."
  depends=('cataclysm-dda' 'sdl2_image' 'sdl2_ttf' 'freetype2' 'sdl2_mixer')
  #cd "Cataclysm-DDA-cdda-experimental-${_pkgver}"
  cd "Cataclysm-DDA-$_pkgver"

  make DESTDIR="$pkgdir" PREFIX="/usr" RELEASE=1 LOCALIZE=1 RUNTESTS=0 VERBOSE=1 PCH=0 LANGUAGES=all TILES=1 SOUND=1 install

  # Icon
  # Icons
  cd build-data/osx/AppIcon.iconset
  for i in *.png
  do
    local _isize="$(echo "$i" | sed -Ee 's/icon_([[:digit:]]+)x\1\.png/\1x\1/')"
    install -Dm644 "$i" "$pkgdir/usr/share/icons/hicolor/$_isize/apps/cataclysm-dda.png"
  done
  cd ../../..

  # Manpage
  install -Dm644 -t "$pkgdir/usr/share/man/man6" "doc/cataclysm-tiles.6"

  #install -D 'build-data/osx/AppIcon.iconset/icon_128x128.png' "$pkgdir/usr/share/icons/hicolor/128x128/apps/$pkgname.png"
  #install -D 'build-data/osx/AppIcon.iconset/icon_128x128.png' "$pkgdir/usr/share/pixmaps/$pkgname.png"
  install -Dm644 "${srcdir}/$pkgname.desktop" "${pkgdir}/usr/share/applications/$pkgname.desktop"

  install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"


  # Tileset
  mv "$srcdir/cataclysm-dda-tileset_undeadpeople-master" "$srcdir/undeadpeople"
  cp --reflink -r "$srcdir/undeadpeople" "$pkgdir/usr/share/cataclysm-dda/gfx"

  #mv "$srcdir/cataclysm-dda-mod_battle-maid-redone-tileset-master" "$srcdir/battle-maid-redone-tileset"
  cp --reflink -r "$srcdir/cataclysm-dda-mod_battle-maid-redone-tileset-master/battle-maid-redone-tileset-pt1" "$pkgdir/usr/share/cataclysm-dda/mods"
  cp --reflink -r "$srcdir/cataclysm-dda-mod_battle-maid-redone-tileset-master/battle-maid-redone-tileset-pt2" "$pkgdir/usr/share/cataclysm-dda/mods"


  # Sound
  mv "$srcdir/cataclysm-dda-soundpack_jcsoundpack-master" "$srcdir/jcsoundpack"
  cp --reflink -r "$srcdir/jcsoundpack" "$pkgdir/usr/share/cataclysm-dda/sound"

  # Music
  mv "$srcdir/cataclysm-dda-musicpack_coag-musicpack-master" "$srcdir/coag-musicpack"
  install -Dm644 "$srcdir/coag-musicpack/musicset.json" "$pkgdir/usr/share/cataclysm-dda/sound/jcsoundpack/musicset.json"
  cp --reflink -r "$srcdir/coag-musicpack/music" "$pkgdir/usr/share/cataclysm-dda/sound/jcsoundpack"


  # hack: remove overlapping files
  cd "$pkgdir/../cataclysm-dda"
  find . -type f -exec rm -f "$pkgdir"/{} \;
  cd "$pkgdir"
  find . -type d -empty -delete
}