contrib/multimc/Pkgfile
2022-09-19 22:37:26 +10:00

75 lines
2.8 KiB
Plaintext

# Description: Minecraft launcher with ability to manage multiple instances.
# URL: https://multimc.org/
# Maintainer: Danny Rawlins, crux at romster dot me
# Depends on: openjdk17-jdk qt5
name=multimc
_pkgname=multimc
version=0.6.16
release=1
source=(#https://github.com/MultiMC/Launcher/archive/refs/tags/0.6.16.tar.gz
https://github.com/MultiMC/Launcher/archive/$version/Launcher-$version.tar.gz
https://github.com/MultiMC/quazip/archive/b1a72ac0bb5a732bf887a535ab75c6f9bedb6b6b.tar.gz
#https://github.com/MultiMC/quazip/archive/multimc-3.tar.gz
#https://github.com/MultiMC/libnbtplusplus/archive/multimc-0.6.1.tar.gz
https://github.com/MultiMC/libnbtplusplus/archive/dc72a20b7efd304d12af2025223fad07b4b78464.tar.gz
"https://files.multimc.org/downloads/mmc-stable-lin64.tar.gz"
"0001-Readd-lin-system-and-LAUNCHER_LINUX_DATADIR.patch"
"fix-jars.patch"
"mmc-brand.patch"
"multimc.desktop"
)
build() {
cd Launcher-$version
patch -p1 < "${SRC}/0001-Readd-lin-system-and-LAUNCHER_LINUX_DATADIR.patch"
patch -p1 < "${SRC}/fix-jars.patch"
patch -p1 < "${SRC}/mmc-brand.patch"
# generate microsoft client id (https://aur.archlinux.org/packages/multimc-git)
pushd ${SRC}/MultiMC/bin
local client_id_asm=$(objdump -j '.text' --no-show-raw-insn -C --disassemble='Secrets::getMSAClientID(unsigned char)' MultiMC)
local client_id="$(grep -oP '[a-z0-9]{2}(?=,%r[89]d)' <<< ${client_id_asm} | tac | tr -d '\n')$(grep -oP '(push.+0x)\K[a-z0-9]{2}' <<< ${client_id_asm} | tac | tr -d '\n')"
client_id="${client_id:0:8}-${client_id:8:4}-${client_id:12:4}-${client_id:16:4}-${client_id:20}"
popd
sed -i 's/""/"'"${client_id}"'"/g' notsecrets/Secrets.cpp
rmdir libraries/libnbtplusplus
rmdir libraries/quazip
ln -sfT $SRC/libnbtplusplus-dc72a20b7efd304d12af2025223fad07b4b78464/ libraries/libnbtplusplus
ln -sfT $SRC/quazip-b1a72ac0bb5a732bf887a535ab75c6f9bedb6b6b/ libraries/quazip
export JAVA_HOME="/usr/lib/java/openjdk17-jdk/"
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DLauncher_LAYOUT=lin-system \
-DLauncher_APP_BINARY_NAME="${_pkgname}" \
-DLauncher_SHARE_DEST_DIR="share/${_pkgname}" \
-DLauncher_LIBRARAY_DEST_DIR="lib/${_pkgname}"
make
make DESTDIR=$PKG install
mkdir -p "${PKG}/etc/ld.so.conf.d"
echo -e "/usr/lib/${_pkgname}" > "${PKG}/etc/ld.so.conf.d/multimc5.conf"
install -D $SRC/Launcher-$version/launcher/package/ubuntu/multimc/opt/multimc/icon.svg \
$PKG/usr/share/pixmaps/multimc.svg
install -D $SRC/multimc.desktop \
$PKG/usr/share/applications/multimc.desktop
# install -D $SRC/Launcher-$version/build/libMultiMC_quazip.so \
# $PKG/usr/lib/libMultiMC_quazip.so
# install -D $SRC/Launcher-$version/build/libMultiMC_nbt++.so \
# $PKG/usr/lib/libMultiMC_nbt++.so
}