gtk/atom/PKGBUILD
2018-11-29 11:09:49 +01:00

99 lines
3.6 KiB
Bash

pkgname=atom
pkgver=1.33.0
pkgrel=1
pkgdesc='A hackable text editor for the 21st Century'
arch=('x86_64')
url='https://github.com/atom/atom'
license=('MIT' 'custom')
depends=('libxkbfile' 'gtk3' 'libxtst' 'libxss' 'alsa-lib' 'nss')
makedepends=('git' 'npm' 'libgnome-keyring' 'gconf' 'python2' 'libsecret')
optdepends=('ctags: symbol indexing support'
'git: Git and GitHub integration')
options=(!emptydirs)
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/atom/atom/archive/v${pkgver}.tar.gz"
'fix-license-path.patch'
'fix-restart.patch')
sha256sums=('109c17d42eed7722eef2ca31e4399bd9113b44a408c3629b8cd7f6805cd8c47e'
'67ecd71b08292218388205ee49e02d176a15bd0c3e74d30cb720b79c6946f4c9'
'a6fa960741823a52b2f82684285e26eb84ce54825dc7ed008fdaca974b60957e')
prepare() {
cd "${srcdir}/${pkgname}-${pkgver}"
patch -Np1 -i "${srcdir}"/fix-license-path.patch
patch -Np1 -i "${srcdir}"/fix-restart.patch
# Workaround for Node 10
sed -e 's|"electron-link": "0.2.0"|"electron-link": "../../electron-link"|' \
-i script/package.json
cd ..
git clone https://github.com/atom/electron-link.git
cd electron-link
git checkout v0.2.0
# FIXME: won't build if manually fix npm warnings
# npm audit fix, remove package-lock to apply the fix
#sed -e 's/"leveldown": "^1.6.0"/"leveldown": "^2.0.1"/' \
# -e 's/"electron": "1.7.10"/"electron": "^2.0.4"/' \
# -e 's/"electron-mocha": "^3.3.0"/"electron-mocha": "^6.0.4"/' \
# -e 's/"mocha": "^3.2.0"/"mocha": "^5.2.0"/' -i package.json
#rm package-lock.json
sed -e 's/"leveldown": "^1.6.0"/"leveldown": "^2.0.1"/' -i package.json
npm install
npx babel src -d lib
cd node_modules/levelup
sed -e 's/"leveldown": "^1.1.0"/"leveldown": "^2.0.1"/' -i package.json
}
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
export PYTHON=/usr/bin/python2
export ATOM_RESOURCE_PATH="$srcdir/atom-$pkgver"
# If unset, ~/.atom/.node-gyp/.atom/.npm is used
export NPM_CONFIG_CACHE="${HOME}/.atom/.npm"
cd script
# FIXME: won't build if manually fix npm warnings
# npm audit fix
#sed -e 's/"babel-core": "5.8.38"/"babel-core": "^6.26.3"/' \
# -e 's/"coffeelint": "1.15.7"/"coffeelint": "^2.1.0"/' \
# -e 's/"electron-packager": "7.3.0"/"electron-packager": "^12.1.0"/' \
# -e 's/"npm": "5.3.0"/"npm": "^6.1.0"/' \
# -e 's/"webdriverio": "2.4.5"/"webdriverio": "^4.13.1"/' -i package.json
npm install
./build
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
install -d -m 755 "${pkgdir}"/usr/share/atom
cp -r out/atom-$pkgver-amd64/* "${pkgdir}"/usr/share/atom
msg "installing .desktop"
install -d -m 755 "${pkgdir}/usr/share/applications"
sed -e "s|<%= appName %>|Atom|" \
-e "s/<%= description %>/${pkgdesc}/" \
-e "s|<%= installDir %>/share/<%= appFileName %>/atom|/usr/bin/atom|" \
-e "s|<%= iconPath %>|atom|" \
resources/linux/atom.desktop.in > "${pkgdir}/usr/share/applications/atom.desktop"
msg "installing icons"
for size in 16 24 32 48 64 128 256 512 1024; do
install -D -m 644 resources/app-icons/stable/png/${size}.png \
"${pkgdir}"/usr/share/icons/hicolor/${size}x${size}/apps/atom.png
done
ln -sf ../../../share/icons/hicolor/1024x1024/apps/atom.png \
"${pkgdir}"/usr/share/atom/resources/atom.png
msg "installing atom.sh"
install -D -m 755 atom.sh "${pkgdir}/usr/bin/atom"
msg "installing license"
install -d -m 755 "${pkgdir}/usr/share/licenses/${pkgname}"
node -e "require('./script/lib/get-license-text')().then((licenseText) => require('fs').writeFileSync('${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.md', licenseText))"
}