summaryrefslogtreecommitdiff
path: root/pcr/reicast-git/PKGBUILD
blob: 20edf1fcb57809e658a48367cab8b2706cc9e131 (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
# Maintainer (Arch): carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG
# Maintainer: André Silva <emulatorman@parabola.nu>
# Maintainer: Márcio Silva <coadde@parabola.nu>

_pkgname=reicast
pkgname=${_pkgname}-git
pkgver=r1688.0e4949e
pkgrel=1
pkgdesc="A multiplatform Sega Dreamcast emulator"
arch=('i686' 'x86_64' 'armv7h')
url="http://${_pkgname}.com/"
license=('GPL2')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
makedepends=('git')
depends=('libgl' 'alsa-plugins' 'libpulse' 'python-evdev' )
source=(${_pkgname}-${pkgver}::"git+https://github.com/${_pkgname}/${_pkgname}-emulator.git"
        'enable_multiplayer_support.patch'
        'fix-dyna-constprop.patch'
        'futuristic-memops.patch'
        'generalize-mappings.patch'
        'loop-tracing.patch'
        'loungekatt_rm-nonfree-fp.patch'
        'multiplayer.patch'
        'multiplayer-unstable.patch'
        'refactor-rend-stuff.patch'
        'sdl-opengl.patch'
        'sh-block-graphs.patch')
sha256sums=('SKIP'
            '12bfc58e12b3ee79b0c82159cdc70c76a4b6804f5c6986853156602bb0e6beb0'
            'c14287cf2b2289b9de28cedeee06fcb89ca40da50e34607780dce55d7d8e5fd6'
            'ce3fe9f10555c473cafbf4e85724ebe7a8535a1fa3bfae3c9bc0fe518024f71e'
            '4c0227db07dc9fa4713694bc438345261e401e0b10c89b25a3c1d20ac9acd9b9'
            'af47982ca67babb18a96014643c2394b45316f474c3b07b4e38079f780606fce'
            '4a6025daded179e88174057affadbcfd539d919c35c36945aa3273fab0b0cb49'
            '09097f59200daaa919fee6f50473f4295a7de6702f40ad5e2648d12c9478a080'
            '7c0e2a158d7d37ddbf99a40d11a0a889e55c1e85f9c17a2602e5a2bc809ff4ac'
            'aead8326ac6815b555be03030ffbdc8f6ced625c980e77eca89e570591c5eb34'
            'cf386ebaeafce046a1fc971a5b140bb6a1245840ad2c2a341541327ed6f5606c'
            '94694d1b615facb39b5ee92ed90c6cefc77fab23fb97f2fcc82e0aa6e1cb14c5')

pkgver() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "${srcdir}/${_pkgname}-${pkgver}"

  # Remove nonfree fp.h header
  # rm -v core/deps/libpng/fp.h

  # Add Multiplayer support
  patch -Np1 -i "$srcdir"/enable_multiplayer_support.patch

  # Add extra patches
  patch -Np1 -i "$srcdir"/fix-dyna-constprop.patch
  patch -Np1 -i "$srcdir"/futuristic-memops.patch
#  patch -Np1 -i "$srcdir"/generalize-mappings.patch
#  patch -Np1 -i "$srcdir"/loop-tracing.patch # failed build on i686
  patch -Np1 -i "$srcdir"/loungekatt_rm-nonfree-fp.patch
  patch -Np1 -i "$srcdir"/refactor-rend-stuff.patch
  patch -Np1 -i "$srcdir"/sdl-opengl.patch
  patch -Np1 -i "$srcdir"/sh-block-graphs.patch

  # Add Multiplayer support (unstable)
  # core/linux-dist/main.cpp
  # evdev_controllers[port] = { -1, NULL };
  # evdev_device_id[port] = -1;
  # maple_controller[port].enabled = true;
#  patch -Np1 -i "$srcdir"/multiplayer-unstable.patch
#  sed -i 's|kcode[[]port[]]|maple_controller[port].buttons|g
#          s|lt[[]port[]]|maple_controller[port].trigger_left|g
#          s|rt[[]port[]]|maple_controller[port].trigger_right|g
#          s|joyx[[]port[]]|maple_controller[port].stick_x|g
#          s|joyy[[]port[]]|maple_controller[port].stick_y|g
#          s|DC_DPAD_LEFT|DC_BTN_DPAD1_LEFT|g
#          s|DC_DPAD_RIGHT|DC_BTN_DPAD1_RIGHT|g
#          s|DC_DPAD_UP|DC_BTN_DPAD1_UP|g
#          s|DC_DPAD_DOWN|DC_BTN_DPAD1_DOWN|g
#          s|DC_DPAD2_LEFT|DC_BTN_DPAD2_LEFT|g
#          s|DC_DPAD2_RIGHT|DC_BTN_DPAD2_RIGHT|g
#          s|DC_DPAD2_UP|DC_BTN_DPAD2_UP|g
#          s|DC_DPAD2_DOWN|DC_BTN_DPAD2_DOWN|g
#          s|const u32 sdl_map_|const DreamcastControllerCodes sdl_map_|
#          s|const u32[*] sdl_map_|const DreamcastControllerCodes* sdl_map_|
#          \|extern u16|d
#          \|extern u32|d
#          \|extern u8 |d
#          \|extern s8 |d
#          \|#define DC_|d
#          \|u16 kcode|d
#          \|u8 rt|d
#          \|u8 lt|d
#          \|u32 vks|d
#          \|s8 joy|d
#          \|int port = 0; port| s|4|MAPLE_NUM_PORTS|
#          \|enum DreamcastController|,+32 d
#          s|#include ["]types[.]h["]|#include "types.h"\n#include "hw/maple/maple_controller.h"|
#         ' core/sdl/sdl.cpp \
#           core/linux-dist/main.cpp \
#           core/linux-dist/main.h \
#           shell/apple/emulator-ios/emulator/EmulatorView.mm
#  sed -i 's|kcode[[]port[]]|maple_controller[port].buttons|g
#          s|lt[[]port[]]|maple_controller[port].trigger_left|g
#          s|rt[[]port[]]|maple_controller[port].trigger_right|g
#          s|joyx[[]port[]]|maple_controller[port].stick_x|g
#          s|joyy[[]port[]]|maple_controller[port].stick_y|g
#          s|DC_DPAD_LEFT|DC_BTN_DPAD1_LEFT|g
#          s|DC_DPAD_RIGHT|DC_BTN_DPAD1_RIGHT|g
#          s|DC_DPAD_UP|DC_BTN_DPAD1_UP|g
#          s|DC_DPAD_DOWN|DC_BTN_DPAD1_DOWN|g
#          s|DC_DPAD2_LEFT|DC_BTN_DPAD2_LEFT|g
#          s|DC_DPAD2_RIGHT|DC_BTN_DPAD2_RIGHT|g
#          s|DC_DPAD2_UP|DC_BTN_DPAD2_UP|g
#          s|DC_DPAD2_DOWN|DC_BTN_DPAD2_DOWN|g
#          \|extern u16|d
#          \|extern u8 |d
#          \|extern s8 |d
#          \|#define key_CONT_|d
#          s|#include ["]glshaders[.]h["]|#include "glshaders.h"\n#include "hw/maple/maple_controller.h"|
#         ' core/rend/gles/gles.cpp
#  sed -i 's|x11_keymap[[]53[]] = DC_BTN_X;|x11_keymap[53] = DC_BTN_X;\nx11_keymap[52] = DC_BTN_Y;|
#         ' core/linux-dist/x11.cpp
#  sed -i 's|DC_BTN_DPAD_|DC_BTN_DPAD1_|
#         ' core/hw/maple/maple_controller.h \
#           core/windows/winmain.cpp \
#           core/rend/gles/gles.cpp \
#           shell/apple/emulator-osx/emulator-osx/osx-main.mm

  # Add experimental shadow support: http://github.com/reicast-emulator/issues/94
  sed -i 's|//DrawModVols|DrawModVols|' core/rend/gles/gldraw.cpp

  # Fix Xbox Input Axis
  sed -i 's|DC_AXIS_LT, 0, 0, DC_AXIS_RT|0, 0, DC_AXIS_RT, DC_AXIS_LT|' core/linux-dist/joystick.cpp
  sed -i 's|DC_AXIS_LT, 0, 0, DC_AXIS_RT|0, 0, DC_AXIS_RT, DC_AXIS_LT|' core/sdl/sdl.cpp

  # Enable Pulseaudio
  sed -i 's|#USE_PULSEAUDIO|USE_PULSEAUDIO|' shell/linux/Makefile
}

build() {
  mkdir -vm 0755 "$srcdir"/pkgbuild-dir
  if [ $CARCH == x86_64 ]; then
    make -C ${_pkgname}-${pkgver}/shell/linux platform=x64 PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-dir install
    # Error in platform=lincpp:
    # ../../core/linux-dist/evdev.cpp:287:65:   required from here
    # /usr/include/c++/5.2.0/tuple:1172:70: error: use of deleted function 'EvdevControllerMapping::EvdevControllerMapping()'
    #          second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
    # mkdir -vm 0755 "$srcdir"/pkgbuild-cpp-dir
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=lincpp PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-cpp-dir install
  elif [ $CARCH == i686 ]; then
    make -C ${_pkgname}-${pkgver}/shell/linux platform=x86 PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-dir install
  elif [ $CARCH == armv7h ]; then
    make -C ${_pkgname}-${pkgver}/shell/linux platform=armv7h    PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-dir           install
    # mkdir -vm 0755 "$srcdir"/pkgbuild-{rpi2,beagle,pandora,odroid{c1,xu3,xu,x2,x,u2}}-dir
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=rpi2      PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-rpi2-dir      install
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=beagle    PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-beagle-dir    install
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=pandora   PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-pandora-dir   install
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=odroidc1  PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-odroidc1-dir  install
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=odroidxu3 PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-odroidxu3-dir install
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=odroidxu  PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-odroidxu-dir  install
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=odroidx2  PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-odroidx2-dir  install
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=odroidx   PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-odroidx-dir   install
    # make -C ${_pkgname}-${pkgver}/shell/linux platform=odroidu2  PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-odroidu2-dir  install
  fi
}

package() {
  cp -va "$srcdir"/pkgbuild-dir/* "$pkgdir"
  if [ -d "$srcdir"/pkgbuild-cpp-dir ]; then
    cp -va "$srcdir"/pkgbuild-cpp-dir/usr/bin/${_pkgname}                        "$pkgdir"/usr/bin/${_pkgname}-c++
    cp -va "$srcdir"/pkgbuild-cpp-dir/usr/share/applications/${_pkgname}.desktop "$pkgdir"/usr/share/applications/${_pkgname}-c++.desktop
    cp -va "$srcdir"/pkgbuild-cpp-dir/usr/share/man/man1/${_pkgname}             "$pkgdir"/usr/share/man/man1/${_pkgname}-c++
    sed -i '\|Name| s|reicast|reicast-c++|
            \|Exec| s|reicast|reicast-c++|
           ' "$pkgdir"/usr/share/applications/${_pkgname}-c++.desktop
  fi
  install -Dm 644 ${_pkgname}-${pkgver}/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}