Changeset 23854

Show
Ignore:
Timestamp:
05.04.2011 18:17:51 (8 years ago)
Author:
xiao
Message:

Changed from trying to pass location of Perl through environment variables to global.properties

Location:
main/trunk/greenstone3
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/build.xml

    r23853 r23854  
    2323  <!--<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>--> 
    2424  <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/> 
    25   <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/> 
     25  <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/> 
     26 
    2627  
    2728  <!-- ===================== Property Definitions =========================== --> 
     
    7576  <!-- get properties from the environment --> 
    7677  <property environment="env"/> 
    77  
    78   <!-- uses perl.path if set in build.properties, otherwise try for 
    79        environment variable PERLPATH, and failing that assumes 'perl'  
    80        is on environment PATH --> 
    81  
    82   <if><bool><isset property="env.PERLPATH"/></bool> 
    83       <property name="perl.path" value="${env.PERLPATH}"/> 
    84   <else> 
    85      <echo> 
    86   Using PATH enviroment variable to locate Perl. 
    87     <exec executable="which"  spawn="false" outputproperty="full.perl.path"> 
    88       <arg value="perl" /> 
    89     </exec> 
    90     <echo> 
    91       <if><equals  arg1="${full.perl.path}" arg2="/usr/bin/perl" /> 
    92     Non-standard location of Perl found: ${full.perl.path} 
    93     Set the environment variable PERLPATH or the perl.path property in 
    94       build.properties to explicitly control the version of Perl used. 
    95     </echo> 
    96   </else> 
    97   </if> 
    98  
    99 <!-- 
    100   <if><bool><isset property="perl.on.path"/></bool> 
    101     <propertyregex property="perl.path" 
    102           input="perl.on.path" 
    103           regexp=".*([^\/]*)" 
    104           select="\1" /> 
    105   </if> 
    106 --> 
    107  
    108   <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" --> 
    109   <if><bool><isset property="perl.path"/></bool> 
    110       <property name="full.perl.path" value="${perl.path}${file.separator}perl"/> 
    111     <else> 
    112       <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/> 
    113     </else> 
    114   </if> 
    11578 
    11679  <!-- get the filesets defining components and executables --> 
     
    591554    description="Update (thru Subversion) all the source (including common-src or collection-building, and runtime), then clean, and re-install. To do this without any SVN updates, run it like 'ant -Dnosvn.mode=yes update'"/> 
    592555 
    593   <target name="start" depends="init,start-tomcat" 
     556 
     557  <target name="perl-for-building" depends="init"> 
     558    <!-- uses perl.path if set in build.properties, otherwise try for 
     559         environment variable PERLPATH, and failing that assumes 'perl'  
     560         is on environment PATH --> 
     561    <if><bool><available file="${build.src.home}"/></bool> 
     562 
     563      <if><bool><not><isset property="perl.path"/></not></bool> 
     564 
     565        <if> 
     566          <bool> 
     567            <and> 
     568              <isset property="env.PERLPATH"/> 
     569              <not><equals arg1="${env.PERLPATH}" arg2=""/></not> 
     570            </and> 
     571          </bool> 
     572          <property name="perl.path" value="${env.PERLPATH}"/> 
     573          <else> 
     574            <echo> 
     575  Using PATH enviroment variable to locate Perl. 
     576            </echo> 
     577            <exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path"> 
     578              <arg value="perl" /> 
     579            </exec> 
     580 
     581            <stringutil string="${full.perl.path}" property="perl.path"> 
     582              <replace regex="\/[^\/]*$" replacement="" /> 
     583            </stringutil> 
     584 
     585            <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool> 
     586              <echo> 
     587    Non-standard location of Perl found: ${full.perl.path} 
     588    Set the environment variable PERLPATH or the perl.path property in 
     589      build.properties to explicitly control the version of Perl used. 
     590              </echo> 
     591            </if> 
     592          </else> 
     593        </if> 
     594      </if> 
     595 
     596      <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" --> 
     597      <if><bool><isset property="perl.path"/></bool> 
     598        <property name="full.perl.path" value="${perl.path}${file.separator}perl"/> 
     599        <else> 
     600          <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/> 
     601        </else> 
     602      </if> 
     603    </if> 
     604  </target> 
     605 
     606  <target name="start" depends="init,configure-web,start-tomcat" 
    594607    description="Startup the Tomcat server." > 
    595608    <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>  
     
    845858  </target> 
    846859 
    847   <target name="configure-web" depends="init" 
     860  <target name="configure-web" depends="init,perl-for-building" 
    848861    description="Configure only the web app config files"> 
    849862    <!-- we want a unix path in the global.properties file --> 
     
    855868    <filter token="tomcat.server" value="${tomcat.server}"/> 
    856869    <filter token="tomcat.port" value="${tomcat.port}"/> 
     870    <filter token="perlpath" value="${perl.path}"/> 
    857871    <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/> 
    858872    <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/> 
     
    9991013  </target> 
    10001014  
     1015   
     1016 
    10011017<!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ --> 
    10021018  <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal"> 
     
    10071023      <!--<env key="GSDLOS" value="linux"/> do we need this?? --> 
    10081024      <env key="GSDL3HOME" value="${basedir}"/> 
    1009       <env key="PERLPATH" value="${perl.path}"/> 
    10101025      <env key="PATH" path="${tomcat.path}"/> 
    10111026      <env key="CATALINA_OPTS" value="${catalina.opts}"/> 
     
    10191034      <env key="GSDLOS" value="windows"/> 
    10201035      <env key="GSDL3HOME" value="${basedir}"/> 
    1021       <env key="PERLPATH" value="${perl.path}"/> 
    10221036      <env key="Path" path="${tomcat.path}"/> 
    10231037      <env key="PATH" path="${tomcat.path}"/> 
  • main/trunk/greenstone3/resources/java/global.properties.in

    r20403 r23854  
     1## Do not edit. This file is automatically generated from  
     2##   <gsdlhome>/resources/java/global.properties.in 
     3 
    14## greenstone home 
    25gsdl3.home=@gsdl3home@ 
    36gsdl3.version=@gsdl3version@ 
     7 
     8# for collection building 
     9perl.path=@perlpath@ 
    410 
    511# tomcat info