updated on Mon Jan 16 04:00:32 UTC 2012
[aur-mirror.git] / greasemonkey-git / PKGBUILD
blob598a2a551b7a87d03c55c38884ea9c8c2ee4ba22
1 # Contributor: Michael Witten <mfwitten>
3 # The various phases of the build can be controlled
4 # with the following variables (use an empty value
5 # to mean false):
7 _source=yes
8 _clean=yes
9 _compile=yes
10 _install=yes
11 #_install=          # do not install
13 ######################################################################
15 pkgname=greasemonkey-git
16 license=(MIT)
17 pkgver=20111012
18 pkgrel=1
19 pkgdesc="A user-script manager for Firefox."
20 arch=(any)
21 url=http://www.greasespot.net/
22 depends=('firefox>=3.0')
23 makedepends=(unzip)
24 provides=(greasemonkey)
26 _gitroot=git://github.com/greasemonkey/greasemonkey.git
27 _gitname=repo 
28 _repo=$srcdir/$_gitname
30 build()
33   #### Source ####
35     if [[ $srcdir ]]; then
37       cd "$srcdir"
39       msg "Getting source code ..."
41       if [[ -d $_gitname ]]; then
43         cd "$_gitname"
44         git pull origin
46       else
48         git clone "$_gitroot" "$_gitname"
50       fi
52     fi
54   #### Clean ####
56     if [[ $_clean ]]; then
58       cd "$_repo"
60       msg "Cleaning ..."
61       git clean -fdx
63     fi
65   #### Compile ####
67     if [[ $_compile ]]; then
68     
69       cd "$_repo"
71       msg "Compiling ..."
72       sh build.sh
74     fi
77 firefox_version()
79   pacman -Ql firefox | while read path; do
80     if [[ $path =~ firefox-([^/]+)/ ]]; then
81       echo ${BASH_REMATCH[1]}
82       break
83     fi
84   done
87 package()
90   #### Install  ####
92     if [[ $_install ]]; then
93     
94       cd "$_repo"
95     
96       local version_firefox="$(firefox_version)"
98       # This isn't very safe over time; XML parsing should really be used
99       local extension_id="`awk -F'<em:id>|</em:id>' '/<em:id>/ {print $2; exit}' install.rdf`"
101       local path_install="$pkgdir/usr/lib/firefox-$version_firefox/extensions/$extension_id"
103       msg "Installing ..."
105       install -d "$path_install"
106       unzip -od "$path_install" *.xpi # it's probably bad to rely on globbing.
108     fi