summaryrefslogtreecommitdiff
path: root/pcr/reicast-git/PKGBUILD
blob: d6d7fa040ec84bdcae1c48bc39ff5eb43f541493 (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
# 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=r1703.a5b7011
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') # 'sdl2')
source=(${_pkgname}-${pkgver}::"git+https://github.com/${_pkgname}/${_pkgname}-emulator.git"
        'fix-dyna-constprop.patch'
        'futuristic-memops.patch'
        'sh-block-graphs.patch'
        'fix-android-translations.patch'
        'purupuru.patch'
        'multiplayer-config.patch')
sha256sums=('SKIP'
            'c14287cf2b2289b9de28cedeee06fcb89ca40da50e34607780dce55d7d8e5fd6'
            'ce3fe9f10555c473cafbf4e85724ebe7a8535a1fa3bfae3c9bc0fe518024f71e'
            '94694d1b615facb39b5ee92ed90c6cefc77fab23fb97f2fcc82e0aa6e1cb14c5'
            'a651fd92d1bfbef0a1ca524c54b2a59a8a45c53ef76a1fe53d36d87abef93a85'
            '02b01a8b1a33aa543213371ec6022559c1eebbeb2d6a20173995ee618d7396a1'
            '9ad37cfed1de29a754388f8655dd58d98a3459d5f65475c8d000d92cabb96e43')

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

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

  # Fix GCC 6.1 errors
  sed -i 's|g++|g++ -std=gnu++98|
         ' shell/linux/Makefile
#  sed -i 's|[#]include[ ][<]stdint[.]h[>]|#include <stdint.h>\n#include <iostream>|
#         ' core/deps/libelf/elf32.cpp
#  sed -i 's|||
#         ' core/linux-dist/evdev.cpp

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

  # Add extra patches
  patch -Np1 -i "$srcdir"/fix-dyna-constprop.patch
  patch -Np1 -i "$srcdir"/futuristic-memops.patch
  patch -Np1 -i "$srcdir"/sh-block-graphs.patch
  patch -Np1 -i "$srcdir"/fix-android-translations.patch

  # Enable PurupuruPack support (rumble)
  patch -Np1 -i "$srcdir"/purupuru.patch

  # Enable Multiplayer config support
  patch -Np1 -i "$srcdir"/multiplayer-config.patch

  # 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

  # Enable SDL
#  sed -i 's|USE_JOYSTICK[ ][:][=][ ]1|USE_JOYSTICK := 1\nUSE_SDL := 1|' shell/linux/Makefile
}

build() {
  mkdir -vm 0755 "$srcdir"/pkgbuild-dir
  mkdir -vm 0755 "$srcdir"/purupuru-dir
  if [ $CARCH == x86_64 ]; then
    make -C ${_pkgname}-${pkgver}/shell/linux platform=x64 PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-dir install
    # Enable Purupuru Pack (rumble support)
    sed -i 's|SegaVMU[,]i[,]1|PurupuruPack,i,1|' ${_pkgname}-${pkgver}/core/hw/maple/maple_cfg.cpp
    make -C ${_pkgname}-${pkgver}/shell/linux platform=x64 PREFIX=/usr DESTDIR="$srcdir"/purupuru-dir install
    # Disabled, due is unsupported code with gnu++11 or gnu++98
    # 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
    # Enable Purupuru Pack (rumble support)
    sed -i 's|SegaVMU[,]i[,]1|PurupuruPack,i,1|' ${_pkgname}-${pkgver}/core/hw/maple/maple_cfg.cpp
    make -C ${_pkgname}-${pkgver}/shell/linux platform=x86 PREFIX=/usr DESTDIR="$srcdir"/purupuru-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"
  cp -va "$srcdir"/purupuru-dir/usr/bin/${_pkgname}	"$pkgdir"/usr/bin/${_pkgname}-purupuru
  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
}