aboutsummaryrefslogtreecommitdiff
path: root/iraf/iraf.ini
blob: 2d264da11aefb4eacd5fbeeee9cf7f3b6679fa10 (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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
[package]
name: iraf
version: 2.16.1

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

[source]
fn: ${package:name}.tar.gz
url: 
    http://ssb.stsci.edu/stripped/linux/${fn} [linux]
    http://ssb.stsci.edu/stripped/osx/${fn}   [osx]

#git_url: ssh://git@bitbucket.org/jhunkeler/${package:name}-combined

[build]
number: 11
detect_binary_files_with_prefix: False [osx]
binary_relocation: False [osx]

[requirements]
# So IRAF and Python 3 are not going to get along for a long time, if ever.
# As much as I'd like to, I can't in good conscience provide py3k support.
build:
    purge_path [py27]
    python [py27]
run:
    ${requirements:build}

[cbc_build]
linux:
    set -x

    #always 32-bit... always
    export IRAFARCH=''
    export target=`uname`.32
    export PLATFORM=
    case "$$target" in
        Linux.32)
            export IRAFARCH='linux'
            export CFLAGS="-m32" 
            export LDFLAGS="-m32" 
            export PLATFORM='linux'
        ;;
        Darwin.32)
            export IRAFARCH='macosx'
            export CFLAGS="-m32 -arch i386" 
            export LDFLAGS="-m32 -arch i386" 
            export PLATFORM='osx'
            #( 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 "{}"

    # Ignore the comments... the fun starts here!
    VARIANTS=http://ssb.stsci.edu/stripped/$$PLATFORM/variants.tar.gz
    curl -O $$VARIANTS
    tar xf variants.tar.gz -C $$PREFIX
    rm -f variants.tar.gz

    # Pseudo-install variant bin directory contents
    mkdir -p $$PREFIX/bin \
        $$PREFIX/share/man
    
    for binary in $$PREFIX/variants/common/bin/*.e
    do
        ( cd $$PREFIX/bin && ln -s -f $$binary )
    done

    X11IRAF=http://ssb.stsci.edu/stripped/$$PLATFORM/x11iraf.tar.gz
    curl -O $$X11IRAF
    # We don't untar directly into PREFIX because it will mangle the structure
    tar xf x11iraf.tar.gz
    rm -f x11iraf.tar.gz

    rsync -aH x11iraf/bin/ $$PREFIX/bin
    rsync -aH x11iraf/man/ $$PREFIX/share/man
    rm -rf x11iraf

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

    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|"

    mkdir -p $$iraf
    rsync -aH `pwd`/ $$iraf

    cd $$iraf

    rm -rf bin_directory
    rm -rf $$iraf/vo/bin.generic/bin.macosx

    #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

    # Setup invocation symlinks
    ( cd $$PREFIX/bin && \
        ln -s -f $$iraf/unix/hlib/cl.sh cl && \
        ln -s -f $$iraf/unix/hlib/mkiraf.sh mkiraf && \
        ln -s -f $$iraf/unix/hlib/mkmlist.csh mkmlist && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/generic.e generic && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/mkpkg.e mkpkg && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/rmbin.e rmbin && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/rmfiles.e rmfiles && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/rpp.e rpp && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/rtar.e rtar &&\
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/sgidispatch.e sgidispatch && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/wtar.e wtar && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/xc.e xc && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/xpp.e && \
        ln -s -f $$iraf/unix/bin.$$IRAFARCH/xyacc.e xyacc )
    
    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"' {} \;

    #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

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

    echo "
    export IRAFARCH=$$IRAFARCH
    export iraf=\$$CONDA_ENV_PATH/iraf/
    export MACH=\$$IRAFARCH
    export hostid=unix
    export host=\$$iraf/\$$hostid/
    export hbin=\$$host/bin.\$$IRAFARCH/
    export IMTOOLRC=\$$iraf/dev/imtoolrc
    export tmp=/tmp/
    
    export CC=gcc
    export F2C=\$$hbin/f2c.e
    export F77=\$$hbin/f77.sh
    export RANLIB=ranlib

    case "$$IRAFARCH" in
    macosx)
    export HSI_CF=\"-O -DMACOSX -w -Wunused -arch i386 -m32 -mmacosx-version-min=10.4\"
    export HSI_XF=\"-Inolibc -/DMACOSX -w -/Wunused -/m32 -/arch -//i386 -/mmacosx-version-min=10.4\"
    export HSI_FF=\"-O -arch i386 -m32 -DBLD_KERNEL -mmacosx-version-min=10.4\"
    export HSI_LF=\"-arch i386 -m32 -mmacosx-version-min=10.4\" 
    ;;

    linux)
    export HSI_CF=\"-I\$$iraf/include -O -DLINUX -DREDHAT -DPOSIX -DSYSV -w -m32 -Wunused\"
    export HSI_FF=\"-I\$$iraf/include -O -DBLD_KERNEL -m32\"
    export HSI_LF=\"-I\$$iraf/include -m32\"
    export HSI_XF=\"-I\$$iraf/include -Inolibc -w -/Wunused -/m32\"
    ;;

    *)
    echo "Unknown IRAFARCH. Dying."
    exit 1
    ;;

    esac

    export HSI_F77LIBS=
    export HSI_LIBS=\"\$$iraf/unix/hlib/libboot.a \$$iraf/lib/libsys.a \$$iraf/lib/libvops.a \$$iraf/unix/hlib/libos.a\"
    export HSI_OSLIBS=
    
    # Pseudo-Ureka
    export UR_BITS=64
    export UR_CPU=x86_64
    export UR_DIR=\$$CONDA_ENV_PATH
    export UR_VARIANT=common
    export UR_OS=$$PLATFORM
    export UR_TMP=/tmp
    export UR_DIR_PKG=\$$UR_DIR/variants/\$$UR_VARIANT/
    " > $$PREFIX/etc/conda/activate.d/iraf.sh
    chmod 755 $$PREFIX/etc/conda/activate.d/iraf.sh

    echo '
    unset iraf
    unset IRAFARCH
    unset IMTOOLRC
    unset F2C
    unset F77
    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_LIBS
    unset HSI_OSLIBS
    unset HSI_XF
    unset MACH
    unset OS_MACH
    unset RANLIB
    unset hostid
    unset tmp
    unset UR_BITS
    unset UR_CPU
    unset UR_DIR
    unset UR_VARIANT
    unset UR_OS
    unset UR_TMP
    unset UR_DIR_PKG
    ' > $$PREFIX/etc/conda/deactivate.d/iraf.sh
    chmod 755 $$PREFIX/etc/conda/deactivate.d/iraf.sh

windows:
    echo Not supported on Windows