summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d56b3d37a2ae9facf33973a04aec1232dbd33870 (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
# Maintainer: Peter blackman <peter at pblackman dot plus dot com>
# Build package from OBS source
# See http://www.c-evo.org/

pkgname=c-evo
pkgver=400
pkgrel=1
pkgdesc="Empire Building Game, C-evo: New Horizons"
arch=('x86_64')
url="https://app.zdechov.net/c-evo"
license=('GPL2')
makedepends=('fpc' 'lazarus-gtk2')
depends=('gtk2')
optdepends=('ffmpeg: Needed for sounds')
conflicts=('c-evo-bin')
source=("$pkgname-$pkgver.orig.tar.xz::https://download.opensuse.org/repositories/home:/PeterBBB/Debian_Testing/c-evo_$pkgver+dfsg.1.orig.tar.xz"
        "$pkgname-$pkgver.debian.tar.xz::https://download.opensuse.org/repositories/home:/PeterBBB/Debian_Testing/c-evo_400+dfsg.1-1.debian.tar.xz")
sha256sums=('380dec7d278778a69b9a39141a9d1fbbb16573df8209f3997debcdbbaf37914a'
            'bed29c2ab017bcec95999968deb1ace45b491983b5408f3ad2cae5d44401e5e1')

prepare() {
  cd "${srcdir}"
  rm -fr "$pkgname-$pkgver"/debian
  mv -t  "$pkgname-$pkgver" debian
  cd "$pkgname-$pkgver"
  patch -Np1 < debian/patches/001-directories.patch
  patch -Np1 < debian/patches/004-stdai.patch
  patch -Np1 < debian/patches/005-cityscreen.patch
  patch -Np1 < debian/patches/006-mapsizes.patch
  patch -Np1 < debian/patches/008-compiler.patch
  patch -Np1 < debian/patches/009-stacktrace.patch
  patch -Np1 < debian/patches/010-splash.patch
  patch -Np1 < debian/patches/012-manual.patch
  patch -Np1 < debian/patches/014-invalidate.patch
  patch -Np1 < debian/patches/016-unsupported.patch
  patch -Np1 < debian/patches/017-citywalls.patch
  patch -Np1 < debian/patches/018-badwindow.patch
  patch -Np1 < debian/patches/020-localization.patch
  patch -Np1 < debian/patches/021-sound.patch
  patch -Np1 < debian/patches/022-buttons.patch
  patch -Np1 < debian/patches/023-stability.patch
  patch -Np1 < debian/patches/024-mapfilename.patch
  patch -Np1 < debian/patches/025-common.patch
  patch -Np1 < debian/patches/026-help.patch

  # Arch does not use a 'games' folder
  sed -i "s|share/games|share|"   debian/extras/$pkgname-launch-gtk2
  sed -i "s|/usr/games|/usr/bin|" debian/extras/$pkgname-launch-gtk2
  sed -i "s|share/games|share|"   debian/extras/$pkgname-launch-qt5
  sed -i "s|/usr/games|/usr/bin|" debian/extras/$pkgname-launch-qt5

  # Corruption.png needs to be upper case
  mv Help/Corruption.png Help/CORRUPTION.png

  # naptid.png wrong place and wrong case
  mv Localization/zh-Hans/Help/naptid.png Help/NAPTID.png

  # Remove readme files (credits moved to copyright file)
  rm -f Maps/readme.txt
  rm -f Graphics/*.credits.txt
  rm -f Localization/cs/readme!!!.txt
  rm -f Localization/ru/ReadMe.txt
  rm -f Localization/zh-Hans/ReadMe.txt
  rm -f Localization/zh-Hant/ReadMe.txt
  rm -f Localization/zh-Hant/Help/naptid.png

  # Remove most of the ocean only maps (now we have the map generator)
  rm -f Maps/0*.png
  rm -f Maps/0*.cevo\ map
}


build() {
  cd "$srcdir/$pkgname-$pkgver"

  # Set temporary folder for lazarus primary config
  rm -fr "$srcdir/config"
  mkdir  "$srcdir/config"

  # clean
  rm -f *.cfg
  rm -f AI/StdAI/*.cfg
  rm -f Packages/CevoComponents/*.cfg
  rm -f Packages/Common/*.cfg
  rm -fr lib
  rm -fr Packages/CevoComponents/lib
  rm -fr Packages/Common/lib
  rm -fr AI/StdAI/lib
  rm -f Switches.inc
  rm -f AI/StdAI/Switches.inc
  rm -fr AI/StdAI/lib
  rm -f  AI/StdAI/*.so
  rm -f  AI/StdAI/*.o
  rm -f  AI/StdAI/*.ppu
  rm -f  AI/StdAI/*.res
  rm -f  AI/StdAI/*.s
  rm -f  *.res *.trc *.o *.ppu *.so
  rm -f  "$pkgname-gtk2  $pkgname-gtk2.dbg"
  rm -f  "$pkgname-gtk3  $pkgname-gtk3.dbg"
  rm -f  "$pkgname-qt5   $pkgname-qt5.dbg"
  rm -f  "$pkgname-fpgui $pkgname-fpgui.dbg"

  # Build AI module
  cp debian/extras/Release.cfg      AI/StdAI/fpc.cfg
  cp debian/extras/Switches.inc AI/StdAI/Switches.inc
  cd AI/StdAI
  fpc -B -vm3175 -olibstdai.so StdAI.lpr

  # Build GTK program
  cd ../../
  cp debian/extras/Release.cfg  fpc.cfg
  cp debian/extras/Release.cfg  Packages/CevoComponents/fpc.cfg
  cp debian/extras/Release.cfg  Packages/Common/fpc.cfg

  # currently cannot build with -pie as the RTL is not built with pie
  sed -i '/-k-pie/d' fpc.cfg

  cp debian/extras/Switches.inc Switches.inc
  rm -fr tmphome
  rm -fr lib
  rm -fr Packages/CevoComponents/lib
  lazbuild -v
  lazbuild --ws=gtk2 -B --bm=Release --lazarusdir=/usr/lib/lazarus --pcp="$srcdir/config" Integrated.lpi
  mv "$pkgname" "$pkgname-gtk2"
}


package() {
  cd "$pkgname-$pkgver"

  install -Dm 644 "debian/extras/$pkgname-gtk2.desktop"         -t "$pkgdir/usr/share/applications"
  install -Dm 644 "debian/extras/$pkgname-manual-gtk2.desktop"  -t "$pkgdir/usr/share/applications"
  install -Dm 644 "debian/extras/$pkgname.svg"                  -t "$pkgdir/usr/share/icons/hicolor/scalable/apps"

  install -Dm 755 "$pkgname-gtk2"                       -t "$pkgdir/usr/bin"
  install -Dm 755 "debian/extras/$pkgname-launch-gtk2"  -t "$pkgdir/usr/bin"
  install -Dm 644 AI/StdAI/StdAI.png                    -t "$pkgdir/usr/share/$pkgname/AI/StdAI"
  install -Dm 644 AI/StdAI/StdAI.ai.txt                 -t "$pkgdir/usr/share/$pkgname/AI/StdAI"
  install -Dm 755 AI/StdAI/libstdai.so                  -t "$pkgdir/usr/lib/$pkgname"

  ln -s "/usr/lib/$pkgname/libstdai.so"                "$pkgdir/usr/share/$pkgname/AI/StdAI/libstdai.so"

  install -Dm 644 readme.txt                        -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/README.source              -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/README.linux               -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/copyright                  -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/changelog                  -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/extras/techchart.png       -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/extras/Tutorial.html       -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/extras/C-evo-HOWTO.html    -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/extras/Release-Notes.txt   -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/extras/C-evo-Mil.html      -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 debian/extras/c-evo-launch-gtk2.6 -t "$pkgdir/usr/share/man/man6"
  install -Dm 644 debian/extras/c-evo-gtk2.6        -t "$pkgdir/usr/share/man/man6"
  install -Dm 644 debian/c-evo-gtk2.metainfo.xml    -t "$pkgdir/usr/share/metainfo"

  install -Dm 644 Language.txt                      -t "$pkgdir/usr/share/$pkgname"
  install -Dm 644 Language2.txt                     -t "$pkgdir/usr/share/$pkgname"
  install -Dm 644 Fonts.txt                         -t "$pkgdir/usr/share/$pkgname"

  install -Dm 644 Graphics/*                        -t "$pkgdir/usr/share/$pkgname/Graphics"
  install -Dm 644 Help/*                            -t "$pkgdir/usr/share/$pkgname/Help"
  install -Dm 644 Maps/*                            -t "$pkgdir/usr/share/$pkgname/Maps"
  install -Dm 644 debian/extras/maps/*              -t "$pkgdir/usr/share/$pkgname/Maps"
  install -Dm 644 Saved/*                           -t "$pkgdir/usr/share/$pkgname/Saved"
  install -Dm 644 Sounds/*                          -t "$pkgdir/usr/share/$pkgname/Sounds"
  install -Dm 644 Tribes/*                          -t "$pkgdir/usr/share/$pkgname/Tribes"

  install -Dm 644 debian/extras/Textures/*.jpg      -t "$pkgdir/usr/share/$pkgname/Graphics"
  install -Dm 644 debian/extras/Sounds/*.mp3        -t "$pkgdir/usr/share/$pkgname/Sounds"

  install -Dm 644 Localization/cs/Help/*            -t "$pkgdir/usr/share/$pkgname/Localization/cs/Help"
  install -Dm 644 Localization/cs/Tribes/*          -t "$pkgdir/usr/share/$pkgname/Localization/cs/Tribes"
  install -Dm 644 Localization/cs/*.txt             -t "$pkgdir/usr/share/$pkgname/Localization/cs"

  install -Dm 644 Localization/de/Help/*            -t "$pkgdir/usr/share/$pkgname/Localization/de/Help"
  install -Dm 644 Localization/de/Tribes/*          -t "$pkgdir/usr/share/$pkgname/Localization/de/Tribes"
  install -Dm 644 Localization/de/*.txt             -t "$pkgdir/usr/share/$pkgname/Localization/de"
  install -Dm 644 debian/extras/de/*.txt            -t "$pkgdir/usr/share/$pkgname/Localization/de"

  install -Dm 644 debian/extras/fr/help.txt         -t "$pkgdir/usr/share/$pkgname/Localization/fr/Help"
  install -Dm 644 debian/extras/fr/StdUnits.txt     -t "$pkgdir/usr/share/$pkgname/Localization/fr/Tribes"
  install -Dm 644 debian/extras/fr/Language*.txt    -t "$pkgdir/usr/share/$pkgname/Localization/fr"

  install -Dm 644 Localization/it/Help/*            -t "$pkgdir/usr/share/$pkgname/Localization/it/Help"
  install -Dm 644 Localization/it/Tribes/*          -t "$pkgdir/usr/share/$pkgname/Localization/it/Tribes"
  install -Dm 644 Localization/it/AI/*              -t "$pkgdir/usr/share/$pkgname/Localization/it/AI"
  install -Dm 644 Localization/it/*.txt             -t "$pkgdir/usr/share/$pkgname/Localization/it"

  install -Dm 644 Localization/ru/Help/*            -t "$pkgdir/usr/share/$pkgname/Localization/ru/Help"
  install -Dm 644 Localization/ru/Tribes/*          -t "$pkgdir/usr/share/$pkgname/Localization/ru/Tribes"
  install -Dm 644 Localization/ru/*.txt             -t "$pkgdir/usr/share/$pkgname/Localization/ru"
  install -Dm 644 debian/extras/ru/*.txt            -t "$pkgdir/usr/share/$pkgname/Localization/ru"

  install -Dm 644 Localization/zh-Hans/Help/*       -t "$pkgdir/usr/share/$pkgname/Localization/zh-Hans/Help"
  install -Dm 644 Localization/zh-Hans/Tribes/*     -t "$pkgdir/usr/share/$pkgname/Localization/zh-Hans/Tribes"
  install -Dm 644 Localization/zh-Hans/Maps/*       -t "$pkgdir/usr/share/$pkgname/Localization/zh-Hans/Maps"
  install -Dm 644 Localization/zh-Hans/*.txt        -t "$pkgdir/usr/share/$pkgname/Localization/zh-Hans"

  install -Dm 644 Localization/zh-Hant/Help/*       -t "$pkgdir/usr/share/$pkgname/Localization/zh-Hant/Help"
  install -Dm 644 Localization/zh-Hant/Tribes/*     -t "$pkgdir/usr/share/$pkgname/Localization/zh-Hant/Tribes"
  install -Dm 644 Localization/zh-Hant/Maps/*       -t "$pkgdir/usr/share/$pkgname/Localization/zh-Hant/Maps"
  install -Dm 644 Localization/zh-Hant/*.txt        -t "$pkgdir/usr/share/$pkgname/Localization/zh-Hant"
}