PKGBUILD 3.61 KB
Newer Older
gnastyle's avatar
gnastyle committed
1
pkgname=atom
Francesco Marinucci's avatar
Francesco Marinucci committed
2
pkgver=1.33.0
3
pkgrel=1
gnastyle's avatar
gnastyle committed
4 5 6 7
pkgdesc='A hackable text editor for the 21st Century'
arch=('x86_64')
url='https://github.com/atom/atom'
license=('MIT' 'custom')
AlmAck's avatar
AlmAck committed
8
depends=('libxkbfile' 'gtk3' 'libxtst' 'libxss' 'alsa-lib' 'nss')
Chaoting Liu's avatar
Chaoting Liu committed
9
makedepends=('git' 'npm' 'libgnome-keyring' 'gconf' 'python2' 'libsecret')
Chaoting Liu's avatar
Chaoting Liu committed
10 11
optdepends=('ctags: symbol indexing support'
            'git: Git and GitHub integration')
gnastyle's avatar
gnastyle committed
12 13 14
options=(!emptydirs)
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/atom/atom/archive/v${pkgver}.tar.gz"
        'fix-license-path.patch'
Chaoting Liu's avatar
Chaoting Liu committed
15
	'fix-restart.patch')
Francesco Marinucci's avatar
Francesco Marinucci committed
16
sha256sums=('109c17d42eed7722eef2ca31e4399bd9113b44a408c3629b8cd7f6805cd8c47e'
17
            '67ecd71b08292218388205ee49e02d176a15bd0c3e74d30cb720b79c6946f4c9'
AlmAck's avatar
AlmAck committed
18
            'a6fa960741823a52b2f82684285e26eb84ce54825dc7ed008fdaca974b60957e')
gnastyle's avatar
gnastyle committed
19 20 21 22 23 24

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

  patch -Np1 -i "${srcdir}"/fix-license-path.patch
  patch -Np1 -i "${srcdir}"/fix-restart.patch
Chaoting Liu's avatar
Chaoting Liu committed
25 26 27 28 29 30 31 32

  # 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
Chaoting Liu's avatar
Chaoting Liu committed
33

34
  # FIXME: won't build if manually fix npm warnings
Chaoting Liu's avatar
Chaoting Liu committed
35
  # npm audit fix, remove package-lock to apply the fix
36 37 38 39 40 41
  #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
Chaoting Liu's avatar
Chaoting Liu committed
42 43 44 45
  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
gnastyle's avatar
gnastyle committed
46 47 48 49 50 51 52 53
}

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
Chaoting Liu's avatar
Chaoting Liu committed
54
  export NPM_CONFIG_CACHE="${HOME}/.atom/.npm"
gnastyle's avatar
gnastyle committed
55 56

  cd script
Chaoting Liu's avatar
Chaoting Liu committed
57

58
  # FIXME: won't build if manually fix npm warnings
Chaoting Liu's avatar
Chaoting Liu committed
59
  # npm audit fix
60 61 62 63 64
  #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
Chaoting Liu's avatar
Chaoting Liu committed
65

gnastyle's avatar
gnastyle committed
66 67 68 69 70 71 72
  npm install
  ./build
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

Chaoting Liu's avatar
Chaoting Liu committed
73
  install -d -m 755 "${pkgdir}"/usr/share/atom
74
  cp -r out/atom-$pkgver-amd64/* "${pkgdir}"/usr/share/atom
gnastyle's avatar
gnastyle committed
75 76 77 78 79

  msg "installing .desktop"
  install -d -m 755 "${pkgdir}/usr/share/applications"
  sed -e "s|<%= appName %>|Atom|" \
      -e "s/<%= description %>/${pkgdesc}/" \
80
      -e "s|<%= installDir %>/share/<%= appFileName %>/atom|/usr/bin/atom|" \
gnastyle's avatar
gnastyle committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
      -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))"
}