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

pkgname=ncl
pkgver=6.6.2
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=('APACHE')
arch=('i686' 'x86_64')
depends=('libxext' 'cairo' 'pixman' 'fontconfig' 'expat' 'bzip2' 'zlib' 'netcdf' 'hdf5' 
         'triangle' 'hdf4' 'netcdf-fortran' 'libxt' 'libxaw' 'libxext' 'libxpm' 'udunits'
         'libx11' 'imake' 'g2clib' 'gdal' 'lesstif' 'glibc' 'libjpeg' 'libpng' 'jasper' 'libaec'
         'libxaw' 'tcsh' 'flex' 'gsl')
makedepends=('gcc' 'gcc-fortran' 'tcsh' 'byacc')
provides=('ncl')
install=${pkgname}.install
backup=(etc/profile.d/ncarg.sh)
source=(ncl-$pkgver.tar.gz::https://github.com/NCAR/ncl/archive/$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/main/f/ncl-5.0.0-no_install_dep.patch
        includes.patch::https://src.fedoraproject.org/rpms/ncl/raw/main/f/ncl-5.1.0-includes.patch
        netcdff.patch::https://src.fedoraproject.org/rpms/ncl/raw/main/f/ncl-5.1.0-netcdff.patch
        paths.patch::https://src.fedoraproject.org/rpms/ncl/raw/main/f/ncl-5.1.0-paths.patch
        ncl-libs.patch::https://src.fedoraproject.org/rpms/ncl/raw/main/f/ncl-libs.patch
        ncl-gdal.patch::https://src.fedoraproject.org/rpms/ncl/raw/main/f/ncl-gdal.patch
        ncl-proj8.patch::https://src.fedoraproject.org/rpms/ncl/raw/main/f/ncl-proj8.patch
        ncl-format.patch::https://src.fedoraproject.org/rpms/ncl/raw/main/f/ncl-format.patch
        ncl-boz.patch::https://src.fedoraproject.org/rpms/ncl/raw/main/f/ncl-boz.patch)
optdepends=('ncl-highres: High-resolution coastlines (RANGS and GSHHS)')
sha256sums=('cad4ee47fbb744269146e64298f9efa206bc03e7b86671e9729d8986bb4bc30e'
            '1766327add038495fa3499e9b7cc642179229750f7201b94f8e1b7bee76f8480'
            'bbb3d9a712107a3cabb427a06960ec0e1db90f3df9891845f8dc7af66f57123a'
            '4e2347ffc7ffe20c32124430c8a165ad9e750f60d9948f11fc7e610aa7130c8e'
            '5b3990a78e849044cd5f0e9d98661f8325b8a5629604237dd3caa1f7e3b6e32e'
            '79a9b66ea670dcf5a69c29ad6eab804e696ca79d050d584d66dafbd2c611bcdb'
            '6b15ccdbd3a5c0d044b867342b5ab9daad1add6f6a488d14be955b172116c0ed'
            '870e6e7a868a3c5c94bcd3f3af898ea9bebd666343e4b0f77e4a74e85aadf55b'
            '4f168597ca725145c009fd33dfde27d50d936412b0365edb33be2f915d1af07c'
            '61b9b3beab800f0de350564a42ccd54d5e7e1e23189199350f084435fbce6564'
            '5a7516b9ddbc1af91518b030f58f4b17de0efb046ba615eab549dde6b0875e04'
            '0ae96df73ac8902b1cd4bab203c45c4bc58b2f645ed094768884f9149066849a'
            'f960b172438485f664a2ce72c47daf5ccd6f3ff81ecd5866ae746c2ae8300529'
            'adb5e0eaa5edcedf0276979431dff2fba3fe7850a5bace3a3071ca858bc8b3b5'
            '64f3502c9deab48615a4cbc26073173081c0774faf75778b044d251e45d238f7')
         
build() {
    # copy triangle library
    cp triangle.c triangle.h ${pkgname}-$pkgver/ni/src/lib/hlu/

    cd ${pkgname}-$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
    patch -Np1 --ignore-whitespace -i ../ncl-gdal.patch
    patch -Np1 --ignore-whitespace -i ../ncl-proj8.patch
    patch -Np1 --ignore-whitespace -i ../ncl-format.patch
    patch -Np1 --ignore-whitespace -i ../ncl-boz.patch
    
    # Spurrious exec permissions
    find -name '*.[fh]' -exec chmod -x {} +
    
    #Fixup LINUX config (to expose vsnprintf prototype)
    sed -i -e '/StdDefines/s/-DSYSV/-D_ISOC99_SOURCE/' config/LINUX
    
    rm -rf external/blas external/lapack
    sed -ri -e 's,-lblas_ncl,-lblas,' \
        -e 's,-llapack_ncl,-llapack,' config/Project

    # configure
    #./Configure -ncar || return 1
    cp ../Site.local config/
    sed -i "s|YmakeRoot /usr|YmakeRoot ${pkgdir}/usr|g" config/Site.local
    # Fixup LINUX config (to expose vsnprintf prototype)
    sed -i -e '/StdDefines/s/-DSYSV/-D_ISOC99_SOURCE/' config/LINUX
    # fix include c.h
    sed -i 's|#include <ncarg/c.h>|#include "c.h"|g' common/src/libncarg_c/env.c \
    common/src/libncarg_c/gsbytes.c common/src/libncarg_c/logic32.c common/src/libncarg_c/logic64.c \
    common/src/libncarg_c/mangle.c common/src/libncarg_c/rwchinfl.c common/src/libncarg_c/trnspprt.c
    # fix netcdf.h
    sed -i 's|#include <netcdf.h>|#include "/usr/include/netcdf.h"|g' `find . -name \*.c`
    sed -i 's|#include <netcdf.h>|#include "/usr/include/netcdf.h"|g' `find . -name \*.h`
    
    ./config/ymkmf

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

package() {
    # install
    cd ${pkgname}-$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 ../ncarg.sh --target-directory=${pkgdir}/etc/profile.d/  

    # copy hluresfile
    install --mode=644 ../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/
}