summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4e108c219a341ef2e470488e898e2ece8b721aef (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
# Maintainer: Peter blackman <peter at pblackman dot plus dot com>
# Build package from source 285..5.6
# See https://app.zdechov.net/c-evo
# See https://svn.zdechov.net/c-evo

pkgname=c-evo
pkgver=285
pkgrel=1
pkgdesc="Empire Building Game"
arch=('x86_64')
url="http://www.c-evo.org/"
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_285+dfsg.6.orig.tar.xz"
      "$pkgname-$pkgver.debian.tar.xz::https://download.opensuse.org/repositories/home:/PeterBBB/Debian_Testing/c-evo_285+dfsg.6-3.debian.tar.xz")
sha256sums=('a0d3594f1b1d9d5bd540a3275414811b23a42462bfb0eda8ca7ed784e2f57ac7'
            '493021b362efca499298c84b8d2edbfcf687ea48206a2b11c2287ec5b2b7ce1b')

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/011-splash.patch
  patch -Np1 < debian/patches/012-manual.patch
  patch -Np1 < debian/patches/014-invalidate.patch
  patch -Np1 < debian/patches/015-wonders.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-autosave.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
}


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

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

  # clean
  rm -fr lib
  rm -fr Packages/CevoComponents/lib
  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"
  rm -f  fpc.cfg

  # 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

  # 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"
  
  mv debian/README.debian debian/README.arch
  
  # Corruption.png needs to be upper case
  # naptid.png wrong place and wrong case
  # Remove readme files (credits moved to copyright file)
  # Remove NewZealand saved game (Won't load in this version)
  # Remove most of the ocean only maps (now we have the map generator)
  mv Help/Corruption.png Help/CORRUPTION.png
  mv Localization/zh-Hans/Help/naptid.png Help/NAPTID.png
  rm Maps/readme.txt
  rm Graphics/*.credits.txt
  rm Localization/cs/readme!!!.txt
  rm Localization/ru/ReadMe.txt
  rm Localization/zh-Hans/ReadMe.txt
  rm Localization/zh-Hant/ReadMe.txt
  rm Localization/zh-Hant/Help/naptid.png
  rm Maps/MyGameNewZealand.cevo
  rm Maps/0*.png
  rm Maps/0*.cevo\ map

  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.arch                -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"
}