2 # Hints for the Cray XT4 Catamount/Qk system:
3 # cross-compilation host is a SuSE x86_64-linux,
4 # execution at the target with the 'yod' utility,
5 # linux.sh will run this hints file when necessary.
7 # cc.sh: compiles the code with the cross-compiler, patches main/exit/_exit
8 # (and traps signals) to be wrappers that echo the exit code.
10 # run.sh: runs the executable with yod and collects the exit status,
11 # and exits with that status.
13 # You probably should do the compilation in non-Lustre filesystem
14 # because Lustre does not support all the POSIX system calls, which may
15 # cause weird errors during the Perl build:
16 # 1182003549.604836:3-24:(super.c:1516:llu_iop_fcntl()): unsupported fcntl cmd 2
18 # As of 2007-Jun (pre-5.9.5) miniperl and libperl.a can be successfully built;
19 # building any extensions would be hard since Perl cannot run anything
20 # external (which breaks MakeMaker, and confuses ext/util/make_ext).
22 # To build libperl.a (which also gets miniperl built):
24 # sh Configure -des -Dusedevel
27 # The -Dusedevel is required for Perl 5.9, it is not required for Perl 5.10
28 # sources, once they come out. You will need to have the run.sh execution
29 # wrapper around (it gets created in the Perl build directory) if you want to
30 # run the miniperl in the XT4. It collects the exit status (note that yod
31 # is run with "-sz 1", so only one instance is run), and possible crash status.
34 # sh run.sh ./miniperl -le 'print 42'
38 '') prefix=/opt/perl-catamount ;;
42 *** You seem to be compiling in Linux for the Catamount/Qk environment.
43 *** I'm therefore not going to install perl as /usr/bin/perl.
44 *** Perl will be installed under $prefix.
48 archname='x86_64-catamount'
51 d_setlocale='undef' # There is setlocale() but no locales.
59 installusrbinperl='undef'
60 libswanted="m crypt c"
63 onlyextensions='Fcntl' # Not that we can build this, really.
68 uselargefiles='define'
75 case "`yod -Version 2>&1`" in
76 Red*) ;; # E.g. "Red Storm Protocol Release 2.1.0"
77 *) echo >&4 "Could not find 'yod', aborting."
81 cat > $run <<'__EOF2__'
86 yod -sz 1 "$@" 2> .yod$$e > .yod$$o
87 status=`awk '/^cata: exe .* pid [0-9][0-9]* (main|exit|_exit) [0-9][0-9]*$/ {print $NF}' .yod$$o|tail -1`
88 grep -v "sz is 1" .yod$$e
89 grep -v "^cata: exe .* pid [0-9][0-9]* " .yod$$o
90 grep "^cata: exe .* signal " .yod$$o
95 case "`cc -V 2>&1`" in
96 *catamount*) ;; # E.g. "/opt/xt-pe/1.5.41/bin/snos64/cc: INFO: catamount target is being used"
97 *) echo "Could not find 'cc' for catamount, aborting."
102 cat > $cc <<__EOF3a__
107 # This is essentially a frontend driver for the Catamount cc.
108 # We arrange for (1) the main(), exit(), _exit() being wrapped (cpp-defined)
109 # catamain(), cataexit(), and _cataexit() (2) the actual main() etc. are in
110 # cata.c, and cata.o is linked in when needed (3) signals being caught
111 # All this mostly for being able to catch the exit status (or crash cause).
117 defs='-Dmain=catamain -Dexit=cataexit -D_exit=_cataexit'
119 BUILD=/wrk/jhi/perl-5.9.x@31393+cata
121 cat >> $cc <<'__EOF3b__'
124 *) if test ! -f cata.o
128 if test -f ../cata.c # If compiling in UU during Configure.
134 $0 --cata_o -c cata.c || exit 1
149 echo "$0: $i: No such file or directory"
154 if grep -q -s '#include "cata.h"' $i
164 if grep -q -s 'int main()' $i
168 if grep -q -s 'int main([^,]*,[^,]*)' $i
172 if grep -q -s 'int main([^,]*,[^,]*,[^,]*)' $i
185 c=$(echo $i|sed 's/\.o$/.c/')
192 argv="$argv -o $exe -Dargv0=$exe"
204 *) argv="$argv cata.o" ;;
208 cc -I$BUILD $argv 2> .cc$$e > .cc$$o
210 egrep -v 'catamount target|'$$'\.c:$' .cc$$e 1>&2
211 case "`grep "is not implemented" .cc$$e`" in
212 *"will always fail"*) status=1 ;;
217 0) rm -f .cc$$e $srct
220 objt=`echo $srct|sed -e 's/\.c$/.o/'`
221 objo=`echo $srco|sed -e 's/\.c$/.o/'`
222 if test -n "$objt" -a -f "$objt"
230 cat >cata.h<<__EOF6__
233 void cataexit(int status);
234 void _cataexit(int status);
236 void catasighandle(int signum);
241 int main(int argc, char **argv);
243 int main(int argc, char **argv, char **env);
249 cat >cata.c<<__EOF7__
258 #define STRINGIFY(a) #a
261 #define ARGV0 STRINGIFY(argv0)
266 void cataexit(int status) {
267 printf("cata: exe %s pid %d exit %d\n", ARGV0, getpid(), status);
270 void _cataexit(int status) {
271 printf("cata: exe %s pid %d _exit %d\n", ARGV0, getpid(), status);
274 void catasighandle(int signum) {
276 printf("cata: exe %s pid %d signal %d\n", ARGV0, getpid(), signum);
291 cataexit(core << 8 | signum);
293 void catasigsetup() {
294 signal(SIGHUP, catasighandle);
295 signal(SIGINT, catasighandle);
296 signal(SIGQUIT, catasighandle);
297 signal(SIGILL, catasighandle);
298 signal(SIGTRAP, catasighandle);
299 signal(SIGABRT, catasighandle);
300 signal(SIGIOT, catasighandle);
302 signal(SIGBUS, catasighandle);
303 signal(SIGFPE, catasighandle);
304 signal(SIGUSR1, catasighandle);
305 signal(SIGUSR2, catasighandle);
306 signal(SIGSEGV, catasighandle);
307 signal(SIGPIPE, catasighandle);
308 signal(SIGALRM, catasighandle);
309 signal(SIGTERM, catasighandle);
310 signal(SIGSTKFLT, catasighandle);
311 signal(SIGCHLD, catasighandle);
312 signal(SIGCONT, catasighandle);
314 signal(SIGTSTP, catasighandle);
315 signal(SIGTTIN, catasighandle);
316 signal(SIGTTOU, catasighandle);
317 signal(SIGURG, catasighandle);
318 signal(SIGXCPU, catasighandle);
319 signal(SIGXFSZ, catasighandle);
320 signal(SIGVTALRM, catasighandle);
321 signal(SIGPROF, catasighandle);
322 signal(SIGWINCH, catasighandle);
323 signal(SIGIO, catasighandle);
324 signal(SIGPWR, catasighandle);
325 signal(SIGSYS, catasighandle);
327 int main(int argc, char *argv[], char *envv[]) {
338 catamain(argc, argv);
340 catamain(argc, argv, envv);
343 printf("cata: exe %s pid %d main %d\n", ARGV0, getpid(), status);
348 echo "Faking DynaLoader"
349 touch DynaLoader.o # Oh, the agony.