#!/usr/local/bin/perl # build.pl for srsldap software # for biodata directories, using SRSv6, LDAP and SOAP(Glue) # d.gilbert, oct. 2002 # Trivial Build Script - changed to Perl use Getopt::Long; print < \$MAKE_SRSLIB, 'java!' => \$MAKE_JAVA, 'slapd!' => \$MAKE_SLAPD, 'tests!' => \$SHOW_TESTS, 'pcrs!' => \$pcrs, 'pthreads!' => \$pthreads, 'gzip!' => \$gzip, 'ldap!' => \$ldap, ); usage() unless($MAKE_SRSLIB||$MAKE_JAVA||$MAKE_SLAPD||$SHOW_TESTS); sub usage() { my $usage= < $MAKE_SRSLIB, -- make srs library 'java!' => $MAKE_JAVA, -- make java classes 'slapd!' => $MAKE_SLAPD, -- make openldap slapd srs backend 'tests!' => $SHOW_TESTS, -- show test commands -- srslib compile options -- 'pcrs!' => $pcrs, -- make and use pcrs C regex package 'pthreads!' => $pthreads, -- use pthreads lib 'gzip!' => $gzip, -- use zlib compression lib 'ldap!' => $ldap -- path to openLdap installation (for slapd make) -- ENV settings -- ENV{SRSROOT} -- SRSROOT + environ paths [SRSROOT='$ENV{SRSROOT}'] ENV{JAVA_HOME} -- java home (java 1.4+ recommended) ENV{CPP} -- c++ compiler HERE die $usage; } # Edit paths as needed # installation folder $ho=`pwd`; chomp($ho); $java=$ENV{JAVA_HOME} || "/usr/java"; # GLUE java soap server libs - copy these for distrib. w/ this srs-ldap-soap server $glu="$ho/lib"; $jld="$ho/lib"; # C++ and C compilers $CPP=$ENV{CPP} || "CC"; $CC=$ENV{CC} || "cc"; # compile flags for srs6ldap.cc # avoid pcrs? - may be memory crasher - used for ldap2srs filter conversion $MAKE_NOPCRS= ($pcrs) ? "" : "-DSRS6LDAP_NOPCRS=1"; # dont need threaded calls in srs6ldap.cc ? $MAKE_PTHREADS= ($pthreads) ? "-DSRS6LDAP_PTHREADS=1" : ''; # define -DSRS6LDAP_NOGZIP=1 for no zlib/gzip compression $MAKE_GZIP= ($gzip) ? '' : "-DSRS6LDAP_NOGZIP=1"; # $TARGET_OS = "unknown"; $OS = `uname`; chomp($OS); if ($OS eq 'SunOS' && (`uname -r` !~ /^[1-4]/)) { $OS = 'Solaris'; } $_= $OS; OSCASE: { if (/Solaris/){ $TARGET_OS = "solaris"; last OSCASE; } if (/SunOS/) { $TARGET_OS = "sunos"; last OSCASE; } if (/OSF1/) { $TARGET_OS = "osf"; last OSCASE; } if (/ULTRIX/) { $TARGET_OS = "ultrix"; last OSCASE; } if (/IRIX/) { $TARGET_OS = "irix"; last OSCASE; } if (/IRIX64/) { $TARGET_OS = "irix64"; last OSCASE; } if (/Linux/) { $TARGET_OS = "linux"; last OSCASE; } if (/AIX/) { $TARGET_OS = "aix"; last OSCASE; } if (/HP-UX/) { $TARGET_OS = "hpux"; last OSCASE; } $TARGET_OS = $OS; warn "Unsupported operating system: $OS"; } ## require use have run srs/prep_srs to set env unless($ENV{SRSSOU} && $ENV{SRSEXE}) { warn "SRS env settings not here. Using '$srsroot' path. This may not work well."; } # locate srs6 directory & libraries - get from ENV if there $sxsrc=$ENV{SRSSOU} || "$srsroot/src"; $sxbin=$ENV{SRSEXE} || "$srsroot/bin/$TARGET_OS"; # ------------------------ # Java compile for GLUE SOAP server # Java source is in iubio/srs/ if ( $MAKE_JAVA ) { print "# Java compile for GLUE SOAP + JavaLDAP servers\n"; chdir( $ho); $GLUEBASE="$glu/GLUE-STD.jar:$glu/dom.jar:$glu/jcert.jar:$glu/jnet.jar:$glu/jsse.jar:$glu/sax.jar:$glu/saxpath.jar:$glu/servlet.jar:$glu/xerces.jar"; $JAVALDAP="$jld/javaldap.jar:$jld/xss4j.jar"; ## also $jld/xerces.jar:$jld/hsqldb-1.61.jar my $cp= ".:$GLUEBASE:$JAVALDAP"; $ENV{CLASSPATH}= $cp; #export CLASSPATH # Compile all .java files under org my @jf= `find iubio -name '*.java' -print`; for my $j (@jf) { chomp $j; print "javac $j\n"; print `javac -classpath $cp $j`; } print "# --- make iubio_jni_SRS.h if need be ---\n"; print " javah iubio.srs.SRSjni\n"; print " mv iubio_srs_SRSjni.h iubio/lib-srs/\n"; print "# Done java\n"; print "\n"; } # ------------------------ # C++ compile libpcrs/pcre - C perl-like regex # pcre-3.9.tar.gz by Philip Hazel # ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz # pcrs-0.0.1-src.tar.gz by Andreas S. Oesterhelt , LGPL - Written and Copyright (C) 2000, 2001 # -- include and build these (in tar.gz) if (! $MAKE_NOPCRS ) { print "\n"; print "# Build C perl-like regex\n"; my $script=<> add these >> -lsrs -lpcre -lpcrs -lz # SRCS = search.c config.c init.c srs6ldap2.cc # OBJS = search.lo config.lo init.lo srs6ldap2.o Monitor.o # XLIBS = libsrs.a libpcrs.a libpcre.a libctreestd.a libgd.a Monitor.o # also need in $ldap/../../include/portable.h # ../../include/portable.h:#define SLAPD_SRS 1 print "# compile OpenLDAP slapd server back-srs backend\n"; if (! -d $ldap ) { print ">>> expecting OpenLDAP source in $ldap\n"; } else { chdir($ho); my $script=< srs.wsdl # run GLUE soap client etc/runglue iubio.srs.SRSsoapclient -w file://srs.wsdl etc/runglue iubio.srs.SRSsoapclient -w file://srs.wsdl getzq1 ## if desired, run GLUE SRSsoap only as http://localhost:8004/glue/srs.wsdl ## same as http://localhost:8004/bionames/services/srs.wsdl # cd jwebserver ; ./srssoap.sh ; cd .. HERE }