summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0cd41c651c1479bf9a6257a3b11c7692d3661aa1 (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
# Maintainer: CUI Hao <cuihao.leo@gmail.com>

pkgname=seismic-unix
pkgver=44R1
pkgrel=2
pkgdesc="A seismic processing and research environment developed at the Center for Wave Phenomena, Colorado School of Mines"
arch=('i686' 'x86_64')
license=('custom')
url="http://www.cwp.mines.edu/cwpcodes/"
depends=('freeglut' 'glu' 'libxmu' 'lesstif')
optdepends=(
    'tcsh: some scripts'
    'gcc-fortran: Fortran support')
makedepends=('gcc-fortran')
source=("ftp://ftp.cwp.mines.edu/pub/cwpcodes/cwp_su_all_$pkgver.tgz")
sha1sums=('af86de42d9686ea8c7606ddc86e6211cce8f480d')
install=seismic-unix.install

prepare() {
    cd ${srcdir}/src
    sed -i 's_/usr/X11[^/]*/_/usr/_' Makefile.config
    sed -i 's_read RESP_RESP=y_' chkroot.sh
    echo -ne '#!/bin/sh\ntrue\n' | tee license.sh mailhome.sh
}

build() {
    export CWPROOT="$srcdir/build"

    mkdir -p "$CWPROOT"
    cd "$CWPROOT"
    ln -sf "$srcdir/src" src

    cd "$srcdir/src"
    make -j1 install
    make -j1 xtinstall
    make -j1 xminstall
    make -j1 finstall
    make -j1 mglinstall
    make -j1 utils
}

package() {
    local CWPROOT="$srcdir/build"
    cd "$CWPROOT"

    install -dm755 "$pkgdir/opt/$pkgname"
    cp -r {,"$pkgdir/opt/$pkgname/"}bin/
    cp -r {,"$pkgdir/opt/$pkgname/"}include/
    cp -r {,"$pkgdir/opt/$pkgname/"}lib/
    cp -r {,"$pkgdir/opt/$pkgname/"}src/
    chmod -R a+r "$pkgdir/opt/$pkgname"
    
    install -dm755 "$pkgdir/usr/share/licenses/$pkgname" 
    install -m644 "$srcdir/src/LEGAL_STATEMENT" "$pkgdir/usr/share/licenses/$pkgname" 
    install -m644 "$srcdir/src/ACKNOWLEDGEMENTS" "$pkgdir/usr/share/licenses/$pkgname" 

    install -dm755 "$pkgdir/etc/profile.d" 
    cat > "$pkgdir/etc/profile.d/$pkgname.sh" << EOF
#!/bin/bash
export CWPROOT="/opt/$pkgname"
export PATH="\$PATH:\$CWPROOT/bin"
EOF
    cat > "$pkgdir/etc/profile.d/$pkgname.csh" << EOF
setenv CWPROOT /opt/$pkgname
setenv PATH \${PATH}:\${CWPROOT}/bin
EOF
    chmod 755 "$pkgdir/etc/profile.d/$pkgname"{.sh,.csh}
}