summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7177c8088a11c6884fcd7e1cfb9af999a79e11da (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
# Maintainer: Yann Forget <forget.yann31@gmail.com>
pkgname=espa-product-formatter
pkgver=1.6.0
pkgrel=1
pkgdesc="libraries and tools for working with the ESPA internal file format"
arch=('x86_64')
url="https://github.com/USGS-EROS/espa-product-formatter"
license=('custom:"Nasa Open Source Agreement"')
depends=('libxml2' 'jbigkit' 'netcdf' 'hdf-eos2' 'hdf-eos5')
provides=('espa-product-formatter')
conflicts=('espa-product-formatter')
source=("https://github.com/USGS-EROS/espa-product-formatter/archive/product_formatter_v1.6.0.tar.gz")
md5sums=('SKIP')
install="$pkgname.install"

prepare() {
        cd "$srcdir"
        mv "espa-product-formatter-product_formatter_v$pkgver" "$pkgname"
        cd "$pkgname"

        mv ESPA-COMMON-LICENSE.txt LICENSE

        python_files=$(find -name '*.py')
        for file in $python_files
        do
            sed -i -e 's:/usr/bin/env python:/usr/bin/env python2:g' $file
        done

        sed -i -e \
            's:python_link_path = $(PREFIX)/python:python_link_path = $(PREFIX)/bin:g' \
            make.config

        sed -i -e \
            's:schema_link_path = $(PREFIX)/schema:schema_link_path = $(PREFIX)/../var/lib/espa/espa-product-formatter/static_data/schema:g' \
            make.config

        sed -i -e \
            's:espa_project_dir = $(prefix)/$(project_name):espa_project_dir = $(prefix)/lib/$(project_name):g' \
            make.config

        sed -i -e \
            's: = ../$(project_name): = ../lib/$(project_name):g' \
            make.config
}


build() {
        cd "$srcdir/$pkgname"

        export HDFEOS_GCTPINC="/usr/include"
        export HDFEOS_GCTPLIB="/usr/lib"
        export TIFFINC="/usr/include"
        export TIFFLIB="/usr/lib"
        export GEOTIFF_INC="/usr/include"
        export GEOTIFF_LIB="/usr/lib"
        export HDFINC="/usr/include"
        export HDFLIB="/usr/lib"
        export HDFEOS_INC="/usr/include"
        export HDFEOS_LIB="/usr/lib"
        export JPEGINC="/usr/include"
        export JPEGLIB="/usr/lib"
        export XML2INC="/usr/include/libxml2"
        export XML2LIB="/usr/lib"
        export PREFIX="/usr"
        export JBIGINC="/usr/include"
        export JBIGLIB="/usr/lib"
        export ZLIBINC="/usr/include"
        export ZLIBLIB="/usr/lib"
        export ESPAINC="$PREFIX/lib/$pkgname/raw_binary/include"
        export ESPALIB="$PREFIX/lib/$pkgname/raw_binary/lib"
        export ESPA_STATIC_DATA_DIR="/var/lib/espa"
        export ESPA_LAND_MASS_POLYGON="$ESPA_STATIC_DATA_DIR/$pkgname/static_data/land_no_buf.ply"
 
        cd "$srcdir/$pkgname/raw_binary"
        make

        cd ../
        make
}

package() {
        mkdir -p "$pkgdir$ESPA_STATIC_DATA_DIR/$pkgname/static_data/schema"
        mkdir -p "$pkgdir$PREFIX/lib/$pkgname"

        cd "$srcdir/$pkgname"
        install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

        cd raw_binary
        make PREFIX="$pkgdir$PREFIX" install
        make PREFIX="$pkgdir$PREFIX" clean

        cd ../
        make PREFIX="$pkgdir$PREFIX" install
        make PREFIX="$pkgdir$PREFIX" clean
}