summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4203890c7a302dd1c5687de27776308a57403847 (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: username227 <gfrank227 at gmail dot com>
# Maintainer: HurricanePootis <hurricanepootis@protonmail.com>
# The pkgbuild is based on the original pkgbuild for citra.

pkgname=lime3ds-git
pkgver=r10410.5c76221
epoch=1
pkgrel=1
arch=('x86_64')
pkgdesc='An experimental open-source Nintendo 3DS emulator/debugger'
url='https://github.com/Lime3DS/Lime3DS'
license=('GPL-2.0-or-later')
depends=('sdl2' 'mbedtls' 'speexdsp' 'qt6-multimedia' 'ffmpeg' 'libfdk-aac' 'libusb' 'openssl' 'glibc' 'gcc-libs' 'sndio' 'zstd' 'soundtouch' 'fmt' 'libinih' 'openal' 'enet' 'zydis' 'boost-libs')
makedepends=('git' 'cmake' 'python' 'doxygen' 'rapidjson' 'llvm' 'qt6-tools' 'gcc' 'glslang' 'vulkan-headers' 'nlohmann-json' 'catch2' 'clang' 'ninja' 'boost')
conflicts=('lime3ds-appimage' 'lime3ds')
provides=('lim3ds')
options=('!lto')
source=("Lime3DS::git+https://github.com/Lime3DS/Lime3DS"
        "boost::git+https://github.com/azahar-emu/ext-boost.git"
        "nihstro::git+https://github.com/neobrain/nihstro.git"
        "catch2::git+https://github.com/catchorg/Catch2.git"
        "soundtouch::git+https://codeberg.org/soundtouch/soundtouch.git"
        "dynarmic::git+https://github.com/azahar-emu/dynarmic.git"
        "git+https://github.com/herumi/xbyak.git"
        "git+https://github.com/lsalzman/enet.git"
        "git+https://github.com/benhoyt/inih.git"
        "libressl::git+https://github.com/azahar-emu/ext-libressl-portable.git"
        "git+https://github.com/libusb/libusb.git"
        "git+https://github.com/mozilla/cubeb"
        "git+https://github.com/azahar-emu/discord-rpc.git"
        "git+https://github.com/arun11299/cpp-jwt.git"
        "git+https://github.com/wwylele/teakra.git"
        "git+https://github.com/lvandeve/lodepng.git"
        "git+https://github.com/facebook/zstd.git"
        "git+https://github.com/lemenkov/libyuv.git"
        "git+https://github.com/abdes/cryptopp-cmake.git"
        "git+https://github.com/weidai11/cryptopp.git"
        "git+https://github.com/kcat/openal-soft"
        "git+https://github.com/KhronosGroup/glslang"
        "vma::git+https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator"
        "vulkan-headers::git+https://github.com/KhronosGroup/Vulkan-Headers"
        "git+https://github.com/azahar-emu/sirit"
        "git+https://github.com/knik0/faad2"
        "library-headers::git+https://github.com/azahar-emu/ext-library-headers.git"
        "git+https://github.com/bylaws/libadrenotools"
        "git+https://github.com/merryhime/oaknut.git"
        "git+https://github.com/septag/dds-ktx"
        "git+https://github.com/fmtlib/fmt.git"
        "sdl2::git+https://github.com/libsdl-org/SDL"
        # cubeb's submodule
        "git+https://github.com/google/googletest.git"
        "git+https://github.com/arsenm/sanitizers-cmake.git"
        #sirit's submodules
        "git+https://github.com/KhronosGroup/SPIRV-Headers.git"
        #libadrenotools submodule
        "git+https://github.com/bylaws/liblinkernsbypass.git"
        "lime3ds-compatibility-list::git+https://github.com/azahar-emu/compatibility-list"
        #dynarmic submodules
        "git+https://github.com/lioncash/biscuit"
        "catch::git+https://github.com/catchorg/Catch2"
	"git+https://github.com/azahar-emu/mcl"
        "git+https://github.com/Tessil/robin-map"
        "zycore::git+https://github.com/zyantific/zycore-c"
        "git+https://github.com/zyantific/zydis"
	"oaknut-dynarmic::git+https://github.com/rtiangha/oaknut.git"
        )
md5sums=('SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP')


pkgver() {
    cd "$srcdir/Lime3DS"
    #echo "r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)" # Get canary version plus commit
}

prepare() {
    cd "$srcdir/Lime3DS"
    git submodule init
    for submodule in {boost,nihstro,catch2,soundtouch,dynarmic,xbyak,enet,inih,libressl,libusb,cubeb,discord-rpc,cpp-jwt,teakra,lodepng,zstd,libyuv,cryptopp-cmake,cryptopp,openal-soft,glslang,vma,vulkan-headers,sirit,faad2,library-headers,libadrenotools,oaknut,dds-ktx,fmt,sdl2,lime3ds-compatibility-list};
    do
    git config submodule.${submodule}.url "$srcdir/${submodule}"
    done
    git -c protocol.file.allow=always submodule update

    cd "$srcdir/Lime3DS/externals/cubeb"
    git submodule init
    git config submodule.googletest.url "$srcdir/googletest"
    git config submodule."cmake/sanitizers-cmake".url "$srcdir/sanitizers-cmake"
    git -c protocol.file.allow=always submodule update

    cd "$srcdir/Lime3DS/externals/sirit/"
    git submodule init
    git config submodule.externals/SPIRV-Headers.url "$srcdir/SPIRV-Headers"
    git -c protocol.file.allow=always submodule update

    cd "$srcdir/Lime3DS/externals/libadrenotools/"
    git submodule init
    git config submodule.lib/linkernsbypass.url "$srcdir/liblinkernsbypass"
    git -c protocol.file.allow=always submodule update 
    
    cd "$srcdir/Lime3DS/externals/dynarmic/"
    git submodule init
    for submodule in {biscuit,catch,fmt,mcl,oaknut,robin-map,xbyak,zycore,zydis}
    do
    git config submodule.externals/${submodule}.url "$srcdir/${submodule}"
    done
    git -c protocol.file.allow=always submodule update --init

    cd "$srcdir/Lime3DS/externals/dynarmic/externals/zydis"
    git submodule init
    git config submodule.dependencies/zycore.url "$srcdir/zycore"
    git -c protocol.file.allow=always submodule update --init
    
    cd "$srcdir/Lime3DS"
    # mkdir build
}

build() {
    # Fix to help cmake find libusb
    export CFLAGS=$(echo $CFLAGS | sed 's/-Wp,-D_FORTIFY_SOURCE=3//g')
    export CXXFLAGS=$(echo $CXXFLAGS | sed 's/-Wp,-D_FORTIFY_SOURCE=3//g')
    CXXFLAGS+=" -I/usr/lib/libusb-1.0 -flto=thin"
    CFLAGS+=" -flto=thin"
    
    cmake -B build -S "Lime3DS" -G Ninja \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_BUILD_TYPE=None \
        -DCMAKE_CXX_COMPILER=clang++ \
        -DCMAKE_C_COMPILER=clang \
        -DENABLE_QT_TRANSLATION=ON \
        -DUSE_DISCORD_PRESENCE=ON \
        -DCMAKE_CXX_FLAGS="$CFLAGS" \
        -DCMAKE_C_FLAGS="$CXXFLAGS" \
        -DUSE_SYSTEM_CATCH2=ON \
        -DUSE_SYSTEM_FMT=ON \
        -DUSE_SYSTEM_GLSLANG=ON \
        -DUSE_SYSTEM_INIH=ON \
        -DUSE_SYSTEM_JSON=ON \
        -DUSE_SYSTEM_LIBUSB=ON \
        -DUSE_SYSTEM_OPENAL=ON \
        -DUSE_SYSTEM_OPENSSL=ON \
        -DUSE_SYSTEM_SDL2=ON \
        -DUSE_SYSTEM_SOUNDTOUCH=ON \
        -DUSE_SYSTEM_VULKAN_HEADERS=ON \
        -DUSE_SYSTEM_ZSTD=ON \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5

    cmake --build build
}

package() {   
    DESTDIR="$pkgdir/" cmake --install build
    rm -rf $pkgdir/usr/include/ "$pkgdir/usr/lib"
}