summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c433c3c73cd78f774a1eb6b5491eeb1a738111e4 (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
# Maintainer: XavierCLL <xavier.corredor.llano (a) gmail.com>

pkgname=ncl
pkgver=6.4.0
pkgrel=2
pkgdesc='Ncar Command Language, is an interpreted language designed specifically for scientific data analysis and visualization'
url='http://www.ncl.ucar.edu'
license=('custom:NCL Source Code License')
arch=('i686' 'x86_64')
depends=('libxext' 'cairo' 'pixman' 'fontconfig' 'expat' 'bzip2' 'zlib' 'netcdf' 'hdf5-cpp-fortran' 
         'triangle' 'hdf4-nonetcdf' 'netcdf-fortran' 'libxt' 'libxaw' 'libxext' 'libxpm' 'udunits'
         'libx11' 'imake' 'g2clib' 'gdal' 'lesstif' 'glibc' 'libjpeg' 'libpng' 'jasper' 'libaec'
         'libxaw' 'tcsh' 'flex' 'gsl' 'hdf-eos2' 'hdf-eos5')
makedepends=('gcc' 'gcc-fortran' 'tcsh' 'byacc')
provides=('ncl')
install=${pkgname}.install
source=("ncl_ncarg-$pkgver.tar.gz::https://www.earthsystemgrid.org/dataset/ncl.640.src/file/ncl_ncarg-$pkgver.tar.gz"
        "http://www.netlib.org/voronoi/triangle.zip" "Site.local" "ncarg.sh" "hluresfile" "ncl.install"
        "no_install_dep.patch::https://src.fedoraproject.org/rpms/ncl/raw/master/f/ncl-5.0.0-no_install_dep.patch"
        "includes.patch::https://src.fedoraproject.org/rpms/ncl/raw/master/f/ncl-5.1.0-includes.patch"
        "netcdff.patch::https://src.fedoraproject.org/rpms/ncl/raw/master/f/ncl-5.1.0-netcdff.patch"
        "paths.patch::https://src.fedoraproject.org/rpms/ncl/raw/master/f/ncl-5.1.0-paths.patch"
        "ncl-libs.patch::https://src.fedoraproject.org/rpms/ncl/raw/master/f/ncl-libs.patch")
optdepends=("ncl-highres: High-resolution coastlines (RANGS and GSHHS)")
md5sums=('a981848ddcaf1c263279648265f24766'
         '10aff8d7950f5e0e2fb6dd2e340be2c9'
         '86851c0e0a36a5dc23dbe1425cb5907c'
         '33fd270a3ea1b4beb770b3e89ada4f59'
         'c18b84591221cf956f3c626cf8766f41'
         '913322ce7d4ca5efed7674693e8a3124'
         'fdafb5d316ee2a86c81030a47cc9aaad'
         'a996694fec633798787cb3f288022125'
         'c40d02a87b447f79d83c3f0d56923db8'
         '9634e0287a4f972e79ceeca44387c13a'
         '2dc539dc3133339aed425aa03f87f103')
         
build() {
    # copy triangle library
    cd $srcdir
    cp triangle.c triangle.h ${pkgname}_ncarg-$pkgver/ni/src/lib/hlu/

    cd $srcdir/${pkgname}_ncarg-$pkgver

    # patchs http://pkgs.fedoraproject.org/cgit/rpms/ncl.git
    patch -Np1 --ignore-whitespace -i ../no_install_dep.patch
    patch -Np1 --ignore-whitespace -i ../includes.patch
    patch -Np1 --ignore-whitespace -i ../netcdff.patch
    patch -Np1 --ignore-whitespace -i ../paths.patch
    patch -Np1 --ignore-whitespace -i ../ncl-libs.patch
    
    # Spurrious exec permissions
    find -name '*.[fh]' -exec chmod -x {} +

    # configure
    #./Configure -ncar || return 1
    cp $srcdir/Site.local config/
    sed -i "s|YmakeRoot /usr|YmakeRoot ${pkgdir}/usr|g" config/Site.local
    ./config/ymkmf

    # build
    make Build CCOPTIONS="-O2 -std=c99 -fPIC -fno-strict-aliasing -fopenmp -DH5Rdereference_vers=1" F77="gfortran" F77_LD="gfortran"\
        CTOFLIBS="-lgfortran" FCOPTIONS="-fPIC -fno-second-underscore -fno-range-check -fopenmp" # >> log 2>&1 
}

package() {
    # install
    cd $srcdir/${pkgname}_ncarg-$pkgver
    make install # >> log 2>&1

    # move libs
    mv ${pkgdir}/usr/share/ncarg/* ${pkgdir}/usr/lib/ncarg/
    rm -rf ${pkgdir}/usr/share/ncarg

    # Use system udunits
    rm -rf ${pkgdir}/usr/lib/ncarg/udunits
    ln -s /usr/share/udunits ${pkgdir}/usr/lib/ncarg/

    # set variable ncarg in system
    install -dv ${pkgdir}/etc/profile.d
    install --mode=755 $srcdir/ncarg.sh --target-directory=${pkgdir}/etc/profile.d/  

    # copy hluresfile
    install --mode=644 $srcdir/hluresfile --target-directory=${pkgdir}/usr/lib/ncarg/

    # compress and put in order man files
    cd $pkgdir/usr/man
    for listman in `ls` 
    do
        mkdir -p $pkgdir/usr/share/man/$listman
        cd $pkgdir/usr/man/$listman
        for manfiles in `ls`
        do
            gzip $manfiles
            mv ${manfiles}.gz $pkgdir/usr/share/man/$listman/
        done
    done
    rm -Rf $pkgdir/usr/man/
}