summaryrefslogtreecommitdiff
path: root/pcr/stumpwm-git/PKGBUILD
blob: eac3d270536699f2bad03e0b33388b6283027c0d (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
150
151
152
153
# Contributor (Arch): M Rawash <mrawash@gmail.com>
# Contributor (Arch): olvar <beren dot olvar (at) gmail dot com>
# Contributor (Arch): Andrew Antle <andrew dot antle at gmail dot com>
# Contributor (Arch): joyfulgirl <joyfulgirl (at) archlinux.us>
# Contributor (Arch): Jonathan Friedman <jonf@gojon.com>
# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io>

pkgname=stumpwm-git
pkgver=20110924
pkgrel=1.1
pkgdesc="A tiling, keyboard-driven window manager written in common lisp"
arch=('i686' 'x86_64' 'mips64el')
url="http://www.nongnu.org/stumpwm/"
license=('GPL2')
provides=('stumpwm')

if pacman -Qq sbcl &>/dev/null; then
    depends=('sbcl' 'clx' 'cl-ppcre')
    _lisp=sbcl
elif pacman -Qq clisp-new-clx &>/dev/null; then
  # If somebody compiled this specially, chances are they want to use it
  depends=('clisp-new-clx' 'cl-ppcre' 'cl-asdf')
  _lisp=clisp
  source=(http://common-lisp.net/project/asdf/asdf.lisp)
  md5sums=('0f172cc814e11054c37c29fa2acfbfae')
else
  # No, this isn't redundant.  
  depends=('sbcl' 'clx' 'cl-ppcre')
  _lisp=sbcl
fi

makedepends=('git' 'texinfo' 'autoconf')
optdepends=('emacs: Edit and eval stumpwm code with M-x stumpwm-mode'
            'alsa-utils: Use contrib/amixer.lisp to control audio volume'
            'aumix: Use contrib/aumix.lisp to control audio volume'
            'mpd: Use contrib/mpd.lisp to control the mpd'
            'surfraw: Use contrib/surfraw.lisp to surf the Internet')
install=stumpwm.install
options=(!strip)  # Thanks to sidereus for pointing this out

_gitroot="git://git.savannah.nongnu.org/stumpwm.git"
_gitname="stumpwm"

build() {
  msg "Connecting to ${_gitroot}..."

  if [ -d ${srcdir}/${_gitname} ] ; then
    cd ${srcdir}/${_gitname} && git pull origin master
  else
    git clone $_gitroot
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting make..."

  rm -rf ${srcdir}/${_gitname}-build
  cp -a ${srcdir}/${_gitname} ${srcdir}/${_gitname}-build
  cd ${srcdir}/${_gitname}-build

  autoconf
  if [ "$_lisp" = "sbcl" ]; then

    ./configure --prefix=/usr \
                --with-lisp=$_lisp \
                --with-ppcre=/usr/share/common-lisp/source/cl-ppcre

    # this is necesary since the AUR packages do not modify the asdf's registry by default
    _sbcl_bopt="sbcl_BUILDOPTS=--eval \"(require :asdf)\" \
                --eval \"(pushnew #p\\\"/usr/share/common-lisp/systems/\\\" asdf:*central-registry* :test #'equal)\" \
                --eval \"(asdf:operate 'asdf:load-op 'clx)\" \
                --load ./make-image.lisp"
    _sbcl_iopt="sbcl_INFOOPTS=--eval \"(require 'asdf)\" \
                --eval \"(pushnew #p\\\"/usr/share/common-lisp/systems/\\\" asdf:*central-registry* :test #'equal)\" \
                --eval \"(asdf:operate 'asdf:load-op 'clx)\" \
                --eval \"(require 'stumpwm)\" \
                --load ./manual.lisp \
                --eval \"(progn (stumpwm::generate-manual) (sb-ext:quit))\""

    make "$_sbcl_bopt" "$_sbcl_iopt"

  elif [ "$_lisp" = "clisp" ]; then
    _lisp_source=/usr/share/common-lisp/source/
    _ppcre_source=${_lisp_source}cl-ppcre/
    
    # Sometimes there are no compiled versions of ppcre.
    # in this case we need to compile and use our own, and then we install them
    if [ ! -f ${_ppcre_source}/api.fas ]; then
    
      _own_fas=1

      mkdir ${srcdir}/cl-ppcre_temp
      mkdir ${srcdir}/cl-ppcre_temp/systems
      mkdir ${srcdir}/cl-ppcre_temp/source
      
      export ASDF_OUTPUT_TRANSLATIONS="/usr/share/common-lisp/source/:${srcdir}/cl-ppcre_temp/source/"
      # for compiling we use the asdf source we donwloaded
      clisp -norc -K full -on-error exit \
            -x "(require 'asdf '(\"${srcdir}/asdf.lisp\"))" \
            -x "(pushnew #p\"/usr/share/common-lisp/systems/\" asdf:*central-registry* :test #'equal)" \
            -x "(asdf:operate 'asdf:compile-op 'cl-ppcre)"
      
      # once we have cl-ppcre compiled we copy the necesary files to 
      # this new location, and set the necessary options for make
      cp $_ppcre_source/cl-ppcre.asd ${srcdir}/cl-ppcre_temp/source/cl-ppcre/
      cp $_ppcre_source/*.lisp ${srcdir}/cl-ppcre_temp/source/cl-ppcre/
      _ppcre_source=${srcdir}/cl-ppcre_temp/source/cl-ppcre/
      
      _clisp_bopt="clisp_BUILDOPTS=-K full -on-error exit \
                  -x \"(require 'asdf '(\\\"asdf.lisp\\\"))\" \
                  -x \"(pushnew \\\"${srcdir}/cl-ppcre_temp/systems/\\\" \
                  asdf:*central-registry* \
                  :test #'equal)\" \
                  -x \"(load \\\"./make-image.lisp\\\")\""
    fi

    ./configure --prefix=/usr \
	              --with-lisp=$_lisp \
                --with-ppcre=$_ppcre_source
      
    if [ -z "$_clisp_bopt" ]; then
		  make
    else
		  make "$_clisp_bopt"
    fi  
  fi
}

package() {
  make destdir=$pkgdir install

  rm -f ${pkgdir}/usr/share/info/dir

  # Installation of stumpish, the contributed lisp,
  # and the emacs stumpwm mode.
  install -m 755 ${srcdir}/${_gitname}-build/contrib/stumpish ${pkgdir}/usr/bin

  install -Dm 644 sample-stumpwmrc.lisp ${pkgdir}/etc/stumpwmrc.sample
  install -d ${pkgdir}/usr/share/${_gitname}
  install -m 644 ${srcdir}/${_gitname}-build/contrib/*.lisp ${pkgdir}/usr/share/${_gitname}

  install -Dm 644 ${srcdir}/${_gitname}-build/contrib/stumpwm-mode.el \
    ${pkgdir}/usr/share/emacs/site-lisp/stumpwm-mode.el
    

  # if we had to compile our own fas files, then we need to install them too.
  if [ "x$_own_fas" = "x1" ]; then
    install -d ${pkgdir}/usr/share/common-lisp/source/cl-ppcre
    install -m 644 ${srcdir}/cl-ppcre_temp/source/cl-ppcre/*.fas \
      ${pkgdir}/usr/share/common-lisp/source/cl-ppcre/
  fi
}

# vim:sw=2 ts=2 et si: