diff options
author | huantian | 2021-08-25 20:29:53 -0700 |
---|---|---|
committer | huantian | 2021-08-25 20:29:53 -0700 |
commit | adb7f9a950a8528b6842e09b5a942ab617663c7d (patch) | |
tree | 3912e199a50c0a68974b75aeb84faaa95a5bcf32 | |
download | aur-adb7f9a950a8528b6842e09b5a942ab617663c7d.tar.gz |
Initial commit! v1.1.15-beta.2
-rw-r--r-- | .SRCINFO | 33 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | PKGBUILD | 72 | ||||
-rw-r--r-- | use-system-7za-and-disable-updater.patch | 164 |
4 files changed, 274 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..2444fe35eeff --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,33 @@ +pkgbase = gdlauncher-beta + pkgdesc = GDLauncher is simple, yet powerful Minecraft custom launcher with a strong focus on the user experience + pkgver = 1.1.15.beta.2 + pkgrel = 1 + url = https://gdevs.io + arch = x86_64 + license = GPL3 + makedepends = gendesk + makedepends = git + makedepends = nodejs + makedepends = npm + makedepends = rust + makedepends = imagemagick + depends = libnotify + depends = libxss + depends = libxtst + depends = libindicator-gtk3 + depends = libappindicator-gtk3 + depends = electron + depends = p7zip + provides = gdlauncher + conflicts = gdlauncher + conflicts = gdlauncher-beta-bin + conflicts = gdlauncher-appimage + conflicts = gdlauncher-git + conflicts = gdlauncher-bin + conflicts = gdlauncher-appimage + source = https://github.com/gorilla-devs/GDLauncher/archive/refs/tags/v1.1.15-beta.2.tar.gz + source = use-system-7za-and-disable-updater.patch + md5sums = 06eff5e281d3f4c3896be2119c373711 + md5sums = 0ccba0e195278ab1de3fec6ea0445afa + +pkgname = gdlauncher-beta diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..e608ad896ba1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +gdlauncher-*.pkg.tar.zst +.directory +v*.tar.gz +pkg +src diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..95bd88abacd2 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,72 @@ +# Maintainer: David Li <davidtianli@gmail.com> +# Based on the PKGBUILD for gdlauncher. +pkgname="gdlauncher-beta" +pkgver="1.1.15.beta.2" +_pkgver="1.1.15-beta.2" +pkgrel=1 +arch=('x86_64') +pkgdesc="GDLauncher is simple, yet powerful Minecraft custom launcher with a strong focus on the user experience" +url="https://gdevs.io" +license=('GPL3') +makedepends=('gendesk' 'git' 'nodejs' 'npm' 'rust' 'imagemagick') +depends=('libnotify' 'libxss' 'libxtst' 'libindicator-gtk3' 'libappindicator-gtk3' 'electron' 'p7zip') +conflicts=('gdlauncher' 'gdlauncher-beta-bin' 'gdlauncher-appimage' 'gdlauncher-git' 'gdlauncher-bin' 'gdlauncher-appimage') +provides=('gdlauncher') +source=("https://github.com/gorilla-devs/GDLauncher/archive/refs/tags/v${_pkgver}.tar.gz" + "use-system-7za-and-disable-updater.patch") +md5sums=('06eff5e281d3f4c3896be2119c373711' + '0ccba0e195278ab1de3fec6ea0445afa') +icon_sizes=(48 128 256 1024) + +prepare() { + # Generate .desktop + gendesk --pkgname "GDLauncher" --pkgdesc "${pkgdesc}" --icon ${pkgname} --exec "/usr/bin/${pkgname}" --categories "Application;Game" -n -f + + cd "${srcdir}/GDLauncher-${_pkgver}/" + + # Apply patches, copied from ObserverOfTime's gdlauncher-git + sed -i package.json \ + -e '/electron-updater/d;/7zip-bin/d' \ + -e 's$public/electron.js$build/electron.js$' \ + -e '/"dependencies"/i\ "bundledDependencies": ["7zip-bin"],' + patch -p1 -i "${srcdir}/use-system-7za-and-disable-updater.patch" + mkdir .git # Husky needs a .git folder to not die +} + +build() { + cd "${srcdir}/GDLauncher-${_pkgver}/" + + # Install required npm packages + export CARGO_HOME="${srcdir}/cargo-cache" + npm install --cache="${srcdir}"/npm-cache + + # Build the program + export CI=false \ + APP_TYPE=electron \ + NODE_ENV=production \ + REACT_APP_RELEASE_TYPE=setup + npx craco build + npx webpack --config scripts/electronWebpackConfig.js +} + +package() { + # Copy runtime files + install -d -m755 "${pkgdir}/usr/lib/gdlauncher/" + rm "${srcdir}/GDLauncher-${_pkgver}/build/installer"{.nsh,{Header,Sidebar}.bmp} # Unecessary install files + cp -r "${srcdir}/GDLauncher-${_pkgver}/"{package.json,build} "${pkgdir}/usr/lib/gdlauncher/" + + # Create run script + install -d -m755 "${pkgdir}/usr/bin/" + printf '#!/bin/sh\nexec electron /usr/lib/gdlauncher "$@"' > "${pkgdir}/usr/bin/gdlauncher" + chmod a+x "${pkgdir}/usr/bin/gdlauncher" + + # Desktop entry + install -d -m755 "${pkgdir}/usr/share/applications/" + install -D -m644 "${srcdir}/GDLauncher.desktop" "${pkgdir}/usr/share/applications/GDLauncher.desktop" + + # Install icons + for size in "${icon_sizes[@]}"; do + install -d -m755 "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/" + convert "${srcdir}/GDLauncher-${_pkgver}/public/icon.png" -resize "${size}x${size}" "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/${pkgname}.png" + done +} diff --git a/use-system-7za-and-disable-updater.patch b/use-system-7za-and-disable-updater.patch new file mode 100644 index 000000000000..a07637c91352 --- /dev/null +++ b/use-system-7za-and-disable-updater.patch @@ -0,0 +1,164 @@ +diff --git i/src/app/desktop/utils/index.js w/src/app/desktop/utils/index.js +index 343d5ad8..45d5a927 100644 +--- i/src/app/desktop/utils/index.js ++++ w/src/app/desktop/utils/index.js +@@ -5,7 +5,6 @@ import { extractFull } from 'node-7z'; + import jimp from 'jimp/es'; + import makeDir from 'make-dir'; + import { promisify } from 'util'; +-import { ipcRenderer } from 'electron'; + import path from 'path'; + import crypto from 'crypto'; + import { exec, spawn } from 'child_process'; +@@ -301,14 +300,7 @@ export const isLatestJavaDownloaded = async (meta, userData, retry) => { + return isValid; + }; + +-export const get7zPath = async () => { +- // Get userData from ipc because we can't always get this from redux +- const baseDir = await ipcRenderer.invoke('getUserData'); +- if (process.platform === 'darwin' || process.platform === 'linux') { +- return path.join(baseDir, '7za'); +- } +- return path.join(baseDir, '7za.exe'); +-}; ++export const get7zPath = async () => '/usr/bin/7za'; + + export const extractNatives = async (libraries, instancePath) => { + const extractLocation = path.join(instancePath, 'natives'); +diff --git i/public/electron.js w/public/electron.js +index 800a66f8..58bfb998 100644 +--- i/public/electron.js ++++ w/public/electron.js +@@ -12,7 +12,6 @@ const { + } = require('electron'); + const path = require('path'); + const { spawn, exec } = require('child_process'); +-const { autoUpdater } = require('electron-updater'); + const log = require('electron-log'); + const fss = require('fs'); + const { promisify } = require('util'); +@@ -179,43 +178,6 @@ log.log(process.env.REACT_APP_RELEASE_TYPE, app.getVersion()); + + const isDev = process.env.NODE_ENV === 'development'; + +-async function extract7z() { +- const baseDir = path.join(app.getAppPath(), 'node_modules', '7zip-bin'); +- +- let zipLocationAsar = path.join(baseDir, 'linux', 'x64', '7za'); +- if (process.platform === 'darwin') { +- zipLocationAsar = path.join(baseDir, 'mac', 'x64', '7za'); +- } +- if (process.platform === 'win32') { +- zipLocationAsar = path.join(baseDir, 'win', 'x64', '7za.exe'); +- } +- try { +- await fs.copyFile( +- zipLocationAsar, +- path.join(app.getPath('userData'), path.basename(zipLocationAsar)) +- ); +- +- if (process.platform === 'linux' || process.platform === 'darwin') { +- await promisify(exec)( +- `chmod +x "${path.join( +- app.getPath('userData'), +- path.basename(zipLocationAsar) +- )}"` +- ); +- await promisify(exec)( +- `chmod 755 "${path.join( +- app.getPath('userData'), +- path.basename(zipLocationAsar) +- )}"` +- ); +- } +- } catch (e) { +- log.error(e); +- } +-} +- +-extract7z(); +- + function createWindow() { + mainWindow = new BrowserWindow({ + width: 1100, +@@ -609,79 +571,3 @@ ipcMain.handle('calculateMurmur2FromPath', (e, filePath) => { + }); + }); + }); +- +-// AutoUpdater +- +-if (process.env.REACT_APP_RELEASE_TYPE === 'setup') { +- autoUpdater.autoDownload = false; +- autoUpdater.allowDowngrade = +- !allowUnstableReleases && app.getVersion().includes('beta'); +- autoUpdater.allowPrerelease = allowUnstableReleases; +- autoUpdater.setFeedURL({ +- owner: 'gorilla-devs', +- repo: 'GDLauncher', +- provider: 'github' +- }); +- +- autoUpdater.on('update-available', () => { +- autoUpdater.downloadUpdate(); +- }); +- +- autoUpdater.on('update-downloaded', () => { +- mainWindow.webContents.send('updateAvailable'); +- }); +- +- ipcMain.handle('checkForUpdates', () => { +- autoUpdater.checkForUpdates(); +- }); +-} +- +-ipcMain.handle('installUpdateAndQuitOrRestart', async (e, quitAfterInstall) => { +- const tempFolder = path.join( +- path.dirname(app.getPath('exe')), +- 'data', +- 'temp' +- ); +- if (process.env.REACT_APP_RELEASE_TYPE === 'setup') { +- autoUpdater.quitAndInstall(true, !quitAfterInstall); +- } else { +- const updaterVbs = 'updater.vbs'; +- const updaterBat = 'updateLauncher.bat'; +- await fs.writeFile( +- path.join(tempFolder, updaterBat), +- `ping 127.0.0.1 -n 1 > nul & robocopy "${path.join( +- tempFolder, +- 'update' +- )}" "." /MOV /E${ +- quitAfterInstall ? '' : ` & start "" "${app.getPath('exe')}"` +- } +- DEL "${path.join(tempFolder, updaterVbs)}" +- DEL "%~f0" +- ` +- ); +- +- await fs.writeFile( +- path.join(tempFolder, updaterVbs), +- `Set WshShell = CreateObject("WScript.Shell") +- WshShell.Run chr(34) & "${path.join( +- tempFolder, +- updaterBat +- )}" & Chr(34), 0 +- Set WshShell = Nothing +- ` +- ); +- +- const updateSpawn = spawn(path.join(tempFolder, updaterVbs), { +- cwd: path.dirname(app.getPath('exe')), +- detached: true, +- shell: true, +- stdio: [ +- 'ignore' /* stdin */, +- 'ignore' /* stdout */, +- 'ignore' /* stderr */ +- ] +- }); +- updateSpawn.unref(); +- mainWindow.close(); +- } +-}); |