summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9183e96d87ad1dbd98cb8c020944e1331c261746 (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
# Maintainer: snafu
# Maintainer: Hyacinthe Cartiaux <hyacinthe dot cartiaux at free dot fr>
pkgname=env-modules
pkgver=5.6.1
pkgrel=2
pkgdesc="Provides for an easy dynamic modification of a user's environment via modulefile."
arch=('i686' 'x86_64')
url='https://envmodules.io/'
license=('GPL-2.0-or-later')
depends=('tcl>=8.5' 'procps')
makedepends=('less')
checkdepends=('dejagnu')
optdepends=('nagelfar' 'python-sphinx')
install=env-modules.install
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/envmodules/modules/releases/download/v${pkgver}/modules-${pkgver}.tar.gz")
sha256sums=('b175e57860e62d87b6118a79cc2d76e857e5774a9ff78558d6726122760b0034')

# Install locations:
_install_prefix=/usr
_config_path=/etc
_profiled=/etc/profile.d
_moduledir=modules

backup=("${_config_path:1}/${_moduledir}/init/modulerc")

build() {
    cd "modules-${pkgver}"

    conf=(
        --prefix=""
        --bindir=/usr/bin
        --libdir=/usr/lib
        --libexecdir=/usr/lib/env-modules
        --etcdir=/etc
        --initdir=/etc/modules/init
        --with-initconf-in=initdir
        --with-moduleshome=/etc/modules
        --datarootdir=/usr/share
        --mandir=/usr/share/man
        --docdir="/usr/share/doc/${pkgname}-${pkgver}"
        --vimdatadir=/usr/share/vim/vimfiles
        --modulefilesdir=/etc/modules/modulefiles
        --disable-set-binpath
        --disable-set-manpath
        --enable-example-modulefiles
        --enable-doc-install
    )

    if type -p nagelfar > /dev/null; then
        conf+=(
            --with-tcl-linter="$(which nagelfar)"
        )
    fi

    ./configure "${conf[@]}"
    make
}

check() {
    cd "modules-${pkgver}"

    # uncomment if you run into problems... takes quite a while
    #make -j1 -k test
}

package() {
    cd "modules-${pkgver}"
    make -j1 DESTDIR="${pkgdir}/" install

    _profiled="${pkgdir}${profiled}"
    mkdir -p "${_profiled}"
    ln -s "../${moduledir}/init/profile.csh" "${_profiled}/env-modules.csh"
    ln -s "../${moduledir}/init/profile.sh"  "${_profiled}/env-modules.sh"

    # Keep up with old versions:
    ln -s ./perl.pm   "${pkgdir}${_config_path}/${_moduledir}/init/perl"
    ln -s ./python.py "${pkgdir}${_config_path}/${_moduledir}/init/python"
}