File:  [mozdev] / sage / build.xml
Revision 1.28: download - view: text, annotated - select for diffs - revision graph
Sun Jun 22 21:39:02 2008 UTC (11 years, 7 months ago) by pandrews
Branches: MAIN
CVS tags: HEAD
convert to two-space tabs

    1: <?xml version="1.0"?>
    2: <!-- ***** BEGIN LICENSE BLOCK *****
    3:    - Version: MPL 1.1/GPL 2.0/LGPL 2.1
    4:    -
    5:    - The contents of this file are subject to the Mozilla Public License Version
    6:    - 1.1 (the "License"); you may not use this file except in compliance with
    7:    - the License. You may obtain a copy of the License at
    8:    - http://www.mozilla.org/MPL/
    9:    -
   10:    - Software distributed under the License is distributed on an "AS IS" basis,
   11:    - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   12:    - for the specific language governing rights and limitations under the
   13:    - License.
   14:    -
   15:    - The Original Code is Sage.
   16:    -
   17:    - The Initial Developer of the Original Code is
   18:    - Peter Andrews <petea@jhu.edu>.
   19:    - Portions created by the Initial Developer are Copyright (C) 2005
   20:    - the Initial Developer. All Rights Reserved.
   21:    -
   22:    - Contributor(s):
   23:    - Peter Andrews <petea@jhu.edu>
   24:    - Erik Arvidsson <erik@eae.net>
   25:    -
   26:    - Alternatively, the contents of this file may be used under the terms of
   27:    - either the GNU General Public License Version 2 or later (the "GPL"), or
   28:    - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   29:    - in which case the provisions of the GPL or the LGPL are applicable instead
   30:    - of those above. If you wish to allow use of your version of this file only
   31:    - under the terms of either the GPL or the LGPL, and not to allow others to
   32:    - use your version of this file under the terms of the MPL, indicate your
   33:    - decision by deleting the provisions above and replace them with the notice
   34:    - and other provisions required by the LGPL or the GPL. If you do not delete
   35:    - the provisions above, a recipient may use your version of this file under
   36:    - the terms of any one of the MPL, the GPL or the LGPL.
   37:    -
   38:    - ***** END LICENSE BLOCK ***** -->
   39: 
   40: <project name="sage" default="build-local">
   41:   
   42:   <property name="build"    location="build"/>
   43:   <property name="src"    location="src"/>
   44:   <property name="tools"    location="tools"/>
   45:   <property name="gecko-sdk"  location="${build}/gecko-sdk"/>
   46:   
   47:   <!-- create build directories -->
   48:   <target name="init" depends="clean">
   49:     <echo>The operating system is ${os.name}</echo>
   50:     <echo>The architecture is ${os.arch}</echo>
   51:     <condition property="isWin"><os family="windows"/></condition>
   52:     <condition property="isMacPPC"><and><os family="mac"/><os family="unix"/><not><equals arg1="${os.arch}" arg2="i386"/></not></and></condition>
   53:     <condition property="isMacX86"><and><os family="mac"/><os family="unix"/><equals arg1="${os.arch}" arg2="i386"/></and></condition>
   54:     <condition property="isLinux"><and><os family="unix"/><not><os family="mac"/></not><not><os name="SunOS"/></not></and></condition>
   55:     <condition property="isSolaris"><os name="SunOS"/></condition>
   56:     <mkdir dir="${build}"/>
   57:     <mkdir dir="${build}/src"/>
   58:     <mkdir dir="${build}/xpi"/>
   59:     <mkdir dir="${build}/xpi/chrome"/>
   60:   </target>
   61: 
   62:   <!-- build from local source files -->
   63:   <target name="build-local" depends="init">
   64:     <copy todir="${build}/src">
   65:       <fileset dir="${src}">
   66:         <include name="**"/>
   67:       </fileset>
   68:     </copy>
   69:     <property name="version" value="sage-local"/>
   70:     <condition property="hasComponents"><available file="${build}/src/components" type="dir"/></condition>
   71:     <condition property="hasModules"><available file="${build}/src/modules" type="dir"/></condition>
   72:     <ant target="xpi"/>
   73:   </target>
   74: 
   75:   <!-- configure Gecko SDK -->
   76:   <target name="gecko-sdk" depends="gecko-sdk-win, gecko-sdk-mac, gecko-sdk-mac-x86, gecko-sdk-linux, gecko-sdk-solaris"/>
   77:   <target name="gecko-sdk-win" if="isWin">
   78:     <unzip src="${tools}/gecko-sdk-win.zip" dest="${build}"/>
   79:     <property name="xpidl_executable" value="xpidl.exe"/>
   80:   </target>
   81:   <target name="gecko-sdk-mac" if="isMacPPC">
   82:     <exec dir="${build}" executable="tar" failonerror="true">
   83:       <arg line="xjf ${tools}/gecko-sdk-mac-ppc.tar.bz2"/>
   84:     </exec>
   85:     <property name="xpidl_executable" value="xpidl"/>
   86:   </target>
   87:   <target name="gecko-sdk-mac-x86" if="isMacX86">
   88:     <exec dir="${build}" executable="tar" failonerror="true">
   89:       <arg line="xjf ${tools}/gecko-sdk-mac-x86.tar.bz2"/>
   90:     </exec>
   91:     <property name="xpidl_executable" value="xpidl"/>
   92:   </target>
   93:   <target name="gecko-sdk-linux" if="isLinux">
   94:     <exec dir="${build}" executable="tar" failonerror="true">
   95:       <arg line="xjf ${tools}/gecko-sdk-linux-x86.tar.bz2"/>
   96:     </exec>
   97:     <property name="xpidl_executable" value="xpidl"/>
   98:   </target>
   99:   <target name="gecko-sdk-solaris" if="isSolaris">
  100:     <exec dir="${build}" executable="gtar" failonerror="true">
  101:       <arg line="xjf ${tools}/gecko-sdk-solaris-x86.tar.bz2"/>
  102:     </exec>
  103:     <property name="xpidl_executable" value="xpidl"/>
  104:   </target>
  105:   
  106:   <!-- compile XPCOM typelib files -->
  107:   <target name="compile-idl" depends="gecko-sdk">
  108:     <apply dir="${build}/src/components" executable="${gecko-sdk}/bin/${xpidl_executable}" failonerror="true">
  109:       <arg line="-m typelib -w -v -I ${gecko-sdk}/idl"/>
  110:       <fileset dir="${build}/src/components">
  111:         <include name="*.idl"/>
  112:       </fileset>
  113:     </apply>
  114:   </target>
  115: 
  116:   <!-- copy component files to XPI directory -->
  117:   <target name="build-components" depends="compile-idl" if="hasComponents">
  118:     <mkdir dir="${build}/xpi/components"/>
  119:     <copy todir="${build}/xpi/components">
  120:       <fileset dir="${build}/src/components">
  121:         <include name="*.xpt"/>
  122:         <include name="*.js"/>
  123:       </fileset>
  124:     </copy>
  125:   </target>
  126:   
  127:   <!-- copy modules to XPI directory -->
  128:   <target name="build-modules" depends="compile-idl" if="hasModules">
  129:     <mkdir dir="${build}/xpi/modules"/>
  130:     <copy todir="${build}/xpi/modules">
  131:       <fileset dir="${build}/src/modules">
  132:         <include name="*.jsm"/>
  133:       </fileset>
  134:     </copy>
  135:   </target>
  136:   
  137:   <!-- assemeble extension structure -->
  138:   <target name="assemble" depends="build-components, build-modules">
  139:     <!-- create main jar file -->
  140:     <zip destfile="${build}/xpi/chrome/${ant.project.name}.jar" basedir="${build}/src/sage" compress="true"/>
  141:     
  142:     <!-- copy defaults -->
  143:     <copy todir="${build}/xpi/defaults" failonerror="false">
  144:       <fileset dir="${build}/src/defaults">
  145:         <include name="**"/>
  146:       </fileset>
  147:     </copy>
  148:     
  149:     <!-- copy install meta files -->
  150:     <copy todir="${build}/xpi">
  151:       <fileset dir="${build}/src">
  152:         <include name="install.*"/>
  153:         <include name="chrome.manifest"/>
  154:       </fileset>
  155:     </copy>
  156:   </target>
  157:   
  158:     <!-- create XPI archive -->
  159:   <target name="xpi" depends="assemble">
  160:     <zip destfile="${build}/${version}.xpi" basedir="${build}/xpi" compress="true"/>
  161:   </target>
  162: 
  163:   <!-- remove build output -->
  164:   <target name="clean">
  165:     <delete dir="${build}"/>
  166:   </target>
  167: 
  168: </project>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>