summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e4e1a1bdcd40e5bcfe8bfb4e75f2e6afbbcb4db1 (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
# Maintainer: FoolEcho <foolecho at gmail dot com>
pkgname=zelda-3t-fr
_name=zelda-3t
pkgver=1.8
pkgrel=6
arch=('i686' 'x86_64')
pkgdesc="Zelda: Time To Triumph (french version)"
url="http://www.zeldaroth.fr/"
license=('Unknown')
depends=('sdl_gfx' 'sdl_mixer' 'sdl_image' 'xdg-utils' 'hicolor-icon-theme' 'timidity++')
makedepends=(imagemagick)
optdepends=('freepats-legacy: soundfont for timidity to be able to have music in game'
  'soundfont-fluid: another soundfont for timidity to be able to have music in game if you prefer')
install=${_name}.install
changelog=ChangeLog
source=(
  "http://www.zeldaroth.fr/fichier/3T/linux/Zelda3T-src-linux.zip" 
  zelda-3t.desktop)
md5sums=('f1d24ec72bff3413cfc1e835ef4703da'
         'ab544512c46a87f6ef62ae6cdea794fc')

prepare () {
  cd $srcdir/Zelda3T-src-linux/
  
  # Fix the Game so that it reads save files from $HOME/.zelda-3t
  sed -i -e s~\"data/save/~string\(getenv\(\"HOME\"\)\)+\"/.$_name/~g Joueur.cpp
  #save/restore volume settings and ranks
  sed -i -e s#\"data/save/system.dat\"#\(string\(getenv\(\"HOME\"\)\)+\"/.$_name/system.dat\"\).c_str\(\)#g Keyboard.cpp
  #remove saves from menu
  sed -i -e s#\"data/save#string\(getenv\(\"HOME\"\)\)+\"/.$_name#g Keyboard.cpp
  #grab rank from Zelda Return of the Hylian
  sed -i -e s#Zelda\ Return\ of\ the\ Hylian/data/save#.zelda-roth#g Keyboard.cpp
  #grab rank from Zelda Oni Link Begins
  sed -i -e s#Zelda\ Oni\ Link\ Begins/data/save#.zelda-olb#g Keyboard.cpp
  
  #Make the game treat /usr/share/$pkgname as its data directory
  for i in *.cpp
  do
    sed -i -e s~data/~/usr/share/$pkgname/~g $i
  done
  
  # Create the directory $HOME/.zelda3t if it doesnt exist
  sed -i -e s~'(NULL));'~'&\n\tif (system(\"stat $HOME/.'$_name' \&> /dev/null")) system (\"mkdir $HOME/.'$_name'\");'~ main.cpp
  
  #Fix the preprocessor options (SDL.h not found)
  sed -i -e "s#CFLAGS  =#CFLAGS  += -I/usr/include/SDL#g" Makefile
  sed -i -e "s#LDFLAGS =#LDFLAGS +=#g" Makefile
}

build () {
  cd $srcdir/Zelda3T-src-linux/
  make
}

package () {
  
  install -Dm644 $_name.desktop $pkgdir/usr/share/applications/$_name.desktop
  cd $srcdir/Zelda3T-src-linux/
  
  install -Dm755 Zelda3T $pkgdir/usr/bin/$_name
  
  cd data
  for i in {map,music,sound}/*
  do
    install -Dm644 $i $pkgdir/usr/share/$pkgname/$i
  done
  
  cd images
  for i in */*
  do
    install -Dm644 $i $pkgdir/usr/share/$pkgname/images/$i
  done
  mkdir -p $pkgdir/usr/share/icons/hicolor/256x256/apps
  convert logos/fond.png -resize 256x256\! $pkgdir/usr/share/icons/hicolor/256x256/apps/$_name.png
}