aboutsummaryrefslogtreecommitdiff
path: root/iraf/iraf.ini
blob: 5e23f1b61fecf6b8a489589daf7ae1d2886d9ce5 (plain) (blame)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
[package]
name: iraf
version: 2.16.1

[about]
home: http://iraf.noao.edu
license: MIT
summary: NOAO Image Reduction and Analysis Facility

[source]
# Remember, always 32-bit! Now feast upon my tears.
#fn: ${package:name}.lnux.x86.fixup.tar.gz
#url: ${cbc_cgi:url}/${fn}
git_url: ssh://git@bitbucket.org/jhunkeler/${package:name}-combined


[build]
number: 6
#detect_binary_files_with_prefix: True

[requirements]
build:
    # Luck
    purge_path
    python
run:
    purge_path
    # Gallant effort
    python

[cbc_build]
linux:
    set -x

    #always 32-bit... always
    export IRAFARCH=''
    export target=`uname`.32
    case "$$target" in
        Linux.32)
            export IRAFARCH='linux'
            export CFLAGS="-m32" 
            export LDFLAGS="-m32" 
        ;;
        Darwin.32)
            export IRAFARCH='macosx'
            export CFLAGS="-m32 -arch i386" 
            export LDFLAGS="-m32 -arch i386" 
            ( cd vendor/x11iraf && ln -sf bin.macintel bin.macosx )
            ( cd vendor/x11iraf && ln -sf lib.macintel lib.macosx )
        ;;
        *)
            echo "UNSUPPORTED ARCHITECTURE (64-bit disabled, by the way...)"
            exit 1
        ;;
    esac
    
    echo "Purging non-architecture files from distribution:"
    find \( -name "bin.*" \( -not -name "bin.$$IRAFARCH" \) -and \( -not -name "bin.generic" \) -and -not -path "*vendor/x11iraf/*" \) | xargs -n1 -I{} rm -rf "{}"

    echo "Fixing c headers..."
    find . -type f -name "*.h" | xargs sed -i -e "s|/iraf/iraf/|$$iraf|"

    echo "Fixing c sources..."
    find . -type f -name "*.c" | xargs sed -i -e "s|/iraf/iraf/|$$iraf|"

    export TERM=xterm
    export PATH=`purge_path /sw`
    export iraf=$$PREFIX/iraf/
    export FAKEHOME=$$PREFIX/iraf-runtime

    mkdir -p $$iraf
    mkdir -p $$FAKEHOME/{bin,cache,imdir}
    rsync -aH `pwd`/ $$iraf
    cd $$iraf

    # drop git directory
    echo "Removing git directory..."
    rm -rf .git

    echo "Fixing bin directory designation"
    ( rm -f bin && ln -s -f "bin.$$IRAFARCH" bin )
    ( cd unix && rm -f bin && ln -s -f "bin.$$IRAFARCH" bin )
    ( cd unix && rm -f as && ln -s -f "as.$$IRAFARCH" as )

    sed -i -e 's|$${HOME}/.iraf/|$${iraf_runtime} -I$${iraf}/include|g' $$iraf/unix/hlib/irafuser.*sh

    yes '' | ./install_not_broken \
                --bindir $$FAKEHOME/bin \
                --cache $$FAKEHOME/cache \
                --imdir $$FAKEHOME/imdir \
                --root $$iraf \
                --mach $$IRAFARCH

    find . -lname '/iraf/iraf/*' \
        -exec sh -c 'echo Re-linking "$$0" ;\
        ln -snf "$$(readlink "$$0" \
        | sed -e "s|/iraf/iraf|../..|" -e "s|/as/|/as.$$IRAFARCH/|")" "$$0"' {} \;

    ln -sfn $$iraf/unix/hlib/libc/iraf.h           include/
    ln -sfn $$iraf/unix/bin.$$IRAFARCH/f2c.h       include/
    ln -sfn $$iraf/unix/hlib/libc/vosproto.h       include/
    ln -sfn $$iraf/unix/boot/xyacc/yaccpar.x       include/
    touch $$iraf/extern/.zzsetenv.def

    gzip -9 unix/bin.$$IRAFARCH/sgi2ueps.e
    rm -f unix/bin.$$IRAFARCH/sgi2ueps.e

    gzip -9 unix/bin.$$IRAFARCH/sgi2uapl.e
    rm -f unix/bin.$$IRAFARCH/sgi2uapl.e

    ( cd $$iraf/extern && ./configure && make install_all )

    # Generate conda environment scripts
    mkdir -p $$PREFIX/etc/conda/{activate.d,deactivate.d}

    echo "
    export iraf=$$PREFIX/iraf/
    export iraf_runtime=\$$iraf/../iraf-runtime
    export IRAFARCH=$$IRAFARCH
    source \$$iraf/unix/hlib/irafuser.sh
    export PATH="\$$iraf_runtime/bin:\$$PATH"
    export PATH="\$$iraf/bin.\$$IRAFARCH:\$$PATH"
    " > $$PREFIX/etc/conda/activate.d/iraf.sh
    chmod 755 $$PREFIX/etc/conda/activate.d/iraf.sh

    echo '
    export PATH=`purge_path $$iraf-runtime`
    export PATH=`purge_path $$iraf/bin.$$IRAFARCH`
    unset iraf
    unset iraf_runtime
    unset IRAFARCH
    unset IMTOOLRC
    unset F2C
    unset F77
    unset HSI_LIBS
    unset hbin
    unset hlib
    unset host
    unset CC
    unset CC_f2c
    unset HSI_CF
    unset HSI_F77LIBS
    unset HSI_FF
    unset HSI_LF
    unset HSI_LFLAGS
    unset HSI_OSLIBS
    unset HSI_XF
    unset MACH
    unset OS_MACH
    unset RANLIB
    unset hostid
    unset tmp
    unset GVBINDIR
    ' > $$PREFIX/etc/conda/deactivate.d/iraf.sh
    chmod 755 $$PREFIX/etc/conda/deactivate.d/iraf.sh

windows:
    echo Not supported on Windows