aboutsummarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bd6c7194be829381bebe6c56d98b174f33ec1fa7 (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
# Maintainer: Brenton Horne <brentonhorne77 at gmail dot com>
_pkgname=atom
_version=arch
_fusurl="https://github.com/fusion809"
_language_patch2_url="${_fusurl}/language-patch2"

# Module Versions
_electron_ver=0.36.12

pkgname=${_pkgname}-editor-${_version}
_atomver=1.9.6
pkgver=1.9.6.aa1.6.2.db0.8.9.fu0.11.1.la0.8.9.lg0.92.2.li1.18.3.ll0.5.1.lp1.0.0.lu0.37.6.t2.3.1.tb0.6.0
pkgrel=1
pkgdesc="Hackable text editor for the 21st Century, built using web technologies, with some extra packages for Arch Linux package development pre-installed."
arch=('x86_64' 'i686')
_url='https://github.com/atom'
url="https://fusion809.github.io/atom-editor-arch/"
license=('MIT')
depends=('namcap' 'alsa-lib' 'desktop-file-utils' 'gconf' 'gtk2' 'libgnome-keyring' 'libnotify' 'libxtst' 'nodejs' 'nss' 'python2' 'git')
optdepends=('gvfs: file deletion support')
makedepends=('npm' 'hunspell-en')
conflicts=('atom-editor-bin' 'atom-editor-beta')
install=${_pkgname}-${_version}.install
source=("${_pkgname}-${_atomver}.tar.gz::${_url}/atom/archive/v${_atomver}.tar.gz"
"about-arch::git+${_fusurl}/about"
"dark-bint-syntax::git+https://github.com/Murriouz/dark-bint-syntax"
"fusion-ui::git+${_fusurl}/fusion-ui"
"language-archlinux::git+${_fusurl}/language-archlinux"
"language-gfm2::git+${_fusurl}/language-gfm2"
"language-ini-desktop::git+${_fusurl}/language-ini-desktop"
"language-liquid::git+https://github.com/puranjayjain/language-liquid"
"language-patch2::git+${_fusurl}/language-patch2"
"language-unix-shell::git+${_fusurl}/language-shellscript"
"git+${_fusurl}/mydict"
"git+${_fusurl}/terminal-fusion"
"git+${_fusurl}/toolbar-fusion"
"atom"
"atom.desktop"
"theme.patch"
"about-arch.patch")
md5sums=('30930e33afdf1828bf481ff7b769d93e'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         '74cc026d4104072dadb2733745f1b268'
         '367f71ad1cfc2e03e97a48d2e32995fb'
         '23a0d25e1759dc5bd0e6f7101fd8ea70'
         'ae16bb627ec10bde20c7093d4be18131')

pkgver() {
  function describe {
    printf "$(git -C "$srcdir/$1" describe --tags `git -C "$srcdir/$1" rev-list --tags --max-count=1` | sed 's/v//g')"
  }
  _about_arch_ver="$(describe about-arch)"
  _dark_bint_syntax_ver="$(describe dark-bint-syntax)"
  _fusion_ui_ver="$(describe fusion-ui)"
  _language_archlinux_ver="$(describe language-archlinux)"
  _language_gfm2_ver="$(describe language-gfm2)"
  _language_ini_desktop_ver="$(describe language-ini-desktop)"
  _language_liquid_ver="$(describe language-liquid)"
  _language_patch2_ver="$(describe language-patch2)"
  _language_unix_shell_ver="$(describe language-unix-shell)"
  _terminal_fusion_ver="$(describe terminal-fusion)"
  _toolbar_fusion_ver="$(describe toolbar-fusion)"
  printf "${_atomver}.aa${_about_arch_ver}.db${_dark_bint_syntax_ver}.fu${_fusion_ui_ver}.la${_language_archlinux_ver}.lg${_language_gfm2_ver}.li${_language_ini_desktop_ver}.ll${_language_liquid_ver}.lp${_language_patch2_ver}.lu${_language_unix_shell_ver}.t${_terminal_fusion_ver}.tb${_toolbar_fusion_ver}"
}

prepare() {
  cd "$srcdir/${_pkgname}-${_atomver}"

  function describe {
    printf "$(git -C "$srcdir/$1" describe --tags `git -C "$srcdir/$1" rev-list --tags --max-count=1` | sed 's/v//g')"
  }
  _about_arch_ver="$(describe about-arch)"
  _dark_bint_syntax_ver="$(describe dark-bint-syntax)"
  _fusion_ui_ver="$(describe fusion-ui)"
  _language_archlinux_ver="$(describe language-archlinux)"
  _language_gfm2_ver="$(describe language-gfm2)"
  _language_ini_desktop_ver="$(describe language-ini-desktop)"
  _language_liquid_ver="$(describe language-liquid)"
  _language_patch2_ver="$(describe language-patch2)"
  _language_unix_shell_ver="$(describe language-unix-shell)"
  _terminal_fusion_ver="$(describe terminal-fusion)"
  _toolbar_fusion_ver="$(describe toolbar-fusion)"

  sed -i -e "/exception-reporting/d" \
         -e "/metrics/d" \
         -e "/-ui/d" \
         -e "/-syntax/d" \
         -e "/-theme/d" \
         -e "s/\"language-gfm\": \".*\",/\"language-gfm2\": \"${_language_gfm2_ver}\",\n    \"language-ini-desktop\": \"${_language_ini_desktop_ver}\",\n    \"language-liquid\": \"${_language_liquid_ver}\",\n    \"language-patch2\": \"${_language_patch2_ver}\",/g" \
         -e "/\"dependencies\": {/a \
                     \"language-patch2\": \"${_language_patch2_url}\"," \
         -e "s/\"language-shellscript\": \".*\",/\"language-unix-shell\": \"${_language_unix_shell_ver}\",\n    \"language-archlinux\": \"${_language_archlinux_ver}\",\n    \"terminal-fusion\": \"${_terminal_fusion_ver}\",\n    \"toolbar-fusion\": \"${_toolbar_fusion_ver}\",/g" \
         -e "s/\"about\": \".*\"/\"about-arch\": \"${_about_arch_ver}\"/g" \
         -e "/\"packageDependencies\": {/a \
              \"dark-bint-syntax\": \"${_dark_bint_syntax_ver}\",\n    \"fusion-ui\": \"${_fusion_ui_ver}\"," package.json

  chmod 755 -R package.json

  if ! [[ -d node_modules ]]; then
    mkdir -p node_modules
  else
    rm -rf node_modules/about-arch
  fi

  sed -i -e 's@node script/bootstrap@node script/bootstrap --no-quiet@g' \
  ./script/build || die "Fail fixing verbosity of script/build"

  # about-arch
  pushd $srcdir/about-arch
  git fetch -p
  git checkout -q $(git describe --tags `git rev-list --tags --max-count=1`)
  patch -Np1 -i $srcdir/about-arch.patch
  popd
  cp -a $srcdir/about-arch node_modules/about-arch

  sed -i -e "s/<%=Desc=%>/$pkgdesc/g" ${srcdir}/${_pkgname}.desktop

  patch -Np1 -i $srcdir/theme.patch
}

build() {
  cd "$srcdir/${_pkgname}-${_atomver}"
  export PYTHON=/usr/bin/python2
  until ./script/build --build-dir "$srcdir/atom-build"; do :; done
}

package() {
  cd "$srcdir/${_pkgname}-${_atomver}"

  script/grunt install --build-dir "$srcdir/atom-build" --install-dir "$pkgdir/usr"

  install -Dm755 $srcdir/${_pkgname} "$pkgdir/usr/bin/${_pkgname}"
  install -Dm644 $srcdir/${_pkgname}.desktop "$pkgdir/usr/share/applications/${_pkgname}.desktop"
  install -Dm644 resources/app-icons/stable/png/1024.png "$pkgdir/usr/share/pixmaps/atom.png"
  install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"

  install -Dm644 $srcdir/mydict/en_AU* "${pkgdir}/usr/share/atom/resources/app.asar.unpacked/node_modules/spell-check/node_modules/spellchecker/vendor/hunspell_dictionaries"
}