summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Reimer2021-04-03 11:06:08 +0200
committerManuel Reimer2021-04-03 11:06:08 +0200
commit3e4c920646aa288a71c16c13f98a994f990607ab (patch)
tree400d46180ab65755dee351b61fba4d2365a4f243
downloadaur-web-ext-git.tar.gz
New PKGBUILD "web-ext-git"
-rw-r--r--.SRCINFO22
-rw-r--r--PKGBUILD67
2 files changed, 89 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..e3246a477eb5
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,22 @@
+pkgbase = web-ext-git
+ pkgdesc = A command line tool to help build, run, and test web extensions
+ pkgver = 6.0.0.r10.g8bd0d13f
+ pkgrel = 1
+ url = https://developer.mozilla.org/en-US/Add-ons/WebExtensions
+ arch = any
+ license = MPL2
+ makedepends = npm
+ makedepends = node-gyp
+ makedepends = git
+ depends = nodejs>=12.0.0
+ provides = nodejs-web-ext
+ provides = web-ext=6.0.0.r10.g8bd0d13f
+ conflicts = nodejs-web-ext
+ conflicts = web-ext
+ replaces = nodejs-web-ext
+ options = !strip
+ source = web-ext-git::git+https://github.com/mozilla/web-ext.git
+ sha256sums = SKIP
+
+pkgname = web-ext-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..54160c8cfcda
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,67 @@
+# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>
+
+_pkgname=web-ext
+pkgname=${_pkgname}-git
+pkgver=6.0.0.r10.g8bd0d13f
+pkgrel=1
+pkgdesc='A command line tool to help build, run, and test web extensions'
+arch=(any)
+url='https://developer.mozilla.org/en-US/Add-ons/WebExtensions'
+license=('MPL2')
+# See upstream package.json
+depends=('nodejs>=12.0.0')
+makedepends=('npm' 'node-gyp' 'git')
+replaces=('nodejs-web-ext')
+provides=('nodejs-web-ext' "${pkgname//-git}=${pkgver}")
+conflicts=('nodejs-web-ext' "$_pkgname")
+# to speed up the build
+options=('!strip')
+# tarball on npmjs lacks scripts for building from sources
+source=("$pkgname::git+https://github.com/mozilla/web-ext.git")
+sha256sums=('SKIP')
+
+pkgver() {
+ cd "$srcdir/$pkgname"
+ git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+prepare() {
+ cd "$srcdir"
+
+ # -build for running webpack and tests, and the original for actual packaging
+ cp -r $pkgname{,-build}
+}
+
+build() {
+ cd "$srcdir/$pkgname-build"
+
+ npm install
+ NODE_ENV=production npm run build
+ cp -r dist "$srcdir/$pkgname"
+
+ cd "$srcdir/$pkgname"
+ npm install --production
+}
+
+check() {
+ cd "$srcdir/$pkgname-build"
+
+ #npm test
+}
+
+package() {
+ local _npmdir="$pkgdir/usr/lib/node_modules/"
+
+ install -Ddm755 "$_npmdir"
+ cp -r --no-preserve=ownership $pkgname "$_npmdir/$_pkgname"
+
+ # dtrace-provider (brought in by bunyan) is not used on Linux, and its build artifacts makes this package unreproducible
+ rm -r "$_npmdir"/web-ext/node_modules/dtrace-provider/build/
+
+ # Non-deterministic race in npm gives 777 permissions to random directories.
+ # See https://github.com/npm/cli/issues/1103 for details.
+ find "${pkgdir}/usr" -type d -exec chmod 755 {} +
+
+ install -Ddm755 "$pkgdir/usr/bin"
+ ln -s "/usr/lib/node_modules/$_pkgname/bin/$_pkgname" "$pkgdir/usr/bin/$_pkgname"
+}