Commit 9ec2ef54 authored by ebruneton's avatar ebruneton
Browse files

updated building process to facilitate Linux packaging

parent 35834bf1
This directory is the base directory. It contains the following items:
- 'archive' directory: jar description files (see archive/README),
- 'build.properties' file: properties to configure the compilation,
- 'build.xml' file: ant xml file to compile, distribute, ...,
- 'config' directory: see config/README,
- 'doc' directory: documentation of the product,
- 'etc' directory (optional): scripts to run the product,
- 'examples' directory: examples of use of the product,
- 'externals' directory (optional): required external libraires (jar files),
- 'jdoc' directory: javadoc description files (see jdoc/README),
- 'src' directory: source of the product,
- 'test' directory: tests of the product (see test/README),
- 'web' directory: source of the web site (see web/README).
This directory is the base directory of the product.
It contains(*) the following items:
- archive: ant files to build the jar(s) of the product,
- build.properties: properties to configure the build process,
- build.xml: main ant file to build the product,
- config: external libraries required only for building the product,
- doc: documentation of the product,
- etc: scripts to run the product,
- examples: examples of use of the product,
- externals: external libraires required for running the product,
- jdoc: ant files to build the javadoc documentation(s) of the product,
- sr': sources of the product,
- test: tests of the product,
- web: source of the web site of the product.
(*) some items may not be present, depending on the product.
This directory contains xml files which describe the build of jars.
The following rules describe the convention to write such an xml file:
This directory contains ant files to build the jars of the product.
The following rules describe the convention to write such files:
- An xml file must describe only one jar file.
- An ant file must build only one jar file.
- The name of the xml file is also the name of the jar:
org_bar_foo.xml describes the content of the org_bar_foo.jar.
- The name of the ant file must be the name of the jar it builds:
org-foo-bar.xml must build org-foo-bar.jar.
- Among the elements which are included into a jar, you must specify
a manifest. It is adviced to store the manifest file in this directory.
the manifest file can shared be by several jars. The name of the manifest
The manifest file can be shared by several jars. The name of the manifest
file must be similar to the name of the jar file.
- Only the default task is called on a xml file.
- Only the default task is called on each ant file.
- The jar file must be produced into the ${dist.lib} directory.
Sample xml file:
Sample ant file:
<project name="foo" default="dist">
<target name="dist">
<jar jarfile="${dist.lib}/org_bar_foo.jar"
basedir="${build}"
manifest="${archive}/bar.mf">
<include name="**/*.class"/>
<include name="**/*.vm"/>
<jar jarfile="${out.dist.lib}/foo.jar"
basedir="${out.build}"
manifest="${archive}/foo.mf">
...
</jar>
</target>
</project>
# Defines values for the 'build.properties' build properties
# This file is used to build the project in the case of bundled external jars
objectweb.ant.tasks.path config/ow_util_ant_tasks.jar
bcel.path test/lib/bcel.jar
serp.path test/lib/serp.jar
class.samples /usr/lib/j2sdk1.4/lib/tools.jar
......@@ -28,19 +28,51 @@
#THE POSSIBILITY OF SUCH DAMAGE.
###############################################################################
#Some information about the product
product.name ASM
product.version 1.4.1
# Some information about the product
# Wich compiler do you want use ?
product.name asm
product.version 1.4.2
###############################################################################
# BUILD
###############################################################################
# Wich compiler do you want to use ?
# jikes is faster than javac but keeps line numbers in compiled classes, even
# with the -O option (javac removes line numbers and local variable names with
# this option, resulting in smaller classes)
build.compiler modern
# Build class path (classes needed to build the project)
# Classpath for the ObjectWeb utility Ant tasks (version 1.1 or higher)
# See http://forge.objectweb.org/projects/monolog
# objectweb.ant.tasks.path
###############################################################################
# TESTS (PERFORMANCE COMPARISONS WITH BCEL AND SERP)
###############################################################################
# Classpath for the BCEL library (version 5.0 or higher)
# See http://jakarta.apache.org/bcel
# bcel.path
# Classpath for the SERP library (version 1.4.2 or higher)
# See http://serp.sourceforge.net
# serp.path
# jar containing lots of representative classes, for performances comparison
# tests (such as the tools.jar file in the JDK's lib directory)
class-samples /usr/lib/j2se/1.3/lib/tools.jar
# class.samples
###############################################################################
# DOCUMENTATION
###############################################################################
# URLs of external Javadocs (JDK)
jdk.url http://java.sun.com/j2se/1.3/docs/api
......@@ -30,24 +30,18 @@
<project name="ASM" default="compile">
<!-- ======================================================================= -->
<!-- This file requires the org.objectweb.util.ant.MultipleAnt class -->
<!-- This file requires the org.objectweb.util.ant.MultipleCopy class -->
<!-- This file requires the org.objectweb.util.ant.JavadocMultipleLink class -->
<!-- ======================================================================= -->
<property file="build.properties"/>
<!-- ==================================== -->
<!-- ======== PROPERTY DEFINITION ======= -->
<!-- ==================================== -->
<property file="build.config"/>
<property file="build.properties"/>
<property name="src" value="${basedir}/src"/>
<property name="test" value="${basedir}/test"/>
<property name="doc" value="${basedir}/doc"/>
<property name="jdoc" value="${basedir}/jdoc"/>
<property name="web" value="${basedir}/web"/>
<property name="externals" value="${basedir}/externals"/>
<property name="examples" value="${basedir}/examples"/>
<property name="examples.common" value="${examples}/common"/>
<property name="config" value="${basedir}/config"/>
......@@ -64,60 +58,54 @@
<property name="out.test" value="${out}/test"/>
<property name="out.zip" value="${out}/zip"/>
<!-- Build a path that contains the external jars -->
<path id="classpath">
<fileset dir="${basedir}">
<include name="externals/**/*.jar"/>
</fileset>
<pathelement location="${out.build}"/>
</path>
<target name="properties">
<condition property="examples.exist">
<available file="${examples}"/>
</condition>
<condition property="web.exist">
<available file="${web}/build.xml"/>
</condition>
<condition property="paths.configured">
<and>
<isset property="objectweb.ant.tasks.path"/>
</and>
</condition>
</target>
<!-- ================================== -->
<!-- ======== TARGET DEFINITION ======= -->
<!-- ======== INITIALIZATION ======= -->
<!-- ================================== -->
<taskdef name="multipleAnt"
classname="org.objectweb.util.ant.MultipleAnt"
classpath="${config}/ow_util_ant_tasks.jar"/>
<taskdef name="javadocMultipleLink"
classname="org.objectweb.util.ant.JavadocMultipleLink"
classpath="${config}/ow_util_ant_tasks.jar"/>
<taskdef name="multipleCopy"
classname="org.objectweb.util.ant.MultipleCopy"
classpath="${config}/ow_util_ant_tasks.jar"/>
<!-- ==================================== -->
<!-- ========== HELP ========== -->
<!-- ==================================== -->
<target name="help">
<echo message="The available targets are the following:"/>
<echo message=" compile: compiles the product into ${out.build}"/>
<echo message=" dist: creates the product's distributions into ${out.dist}"/>
<echo message=" zip: creates the product's distributions zip files into ${out.zip}"/>
<echo message=" clean: removes all generated files."/>
<echo message=" jar: creates all jars in ${out.dist.lib}"/>
<echo message=" test: run all tests"/>
<echo message=""/>
<echo message="There are some options to run tests:"/>
<echo message=" -Dtest.group=&lt;group name&gt; Only a group of test: The default target of"/>
<echo message=" the xml file is called the test.group contains the xml file name with"/>
<echo message=" directory ex: ant -Dtest.group=conform/toto test =&gt; calls the default"/>
<echo message=" target of the file ${test}/conform/toto.xml"/>
<echo message=" -Dtest.type=&lt;type name&gt; Only a type of test: conform, deviance, stress,"/>
<echo message=" thread or perf. The test.type properties contains the directory name of"/>
<echo message=" the test type ex: ant -Dtest.type=conform test"/>
<echo message=" -Dtest.name=&lt;test name&gt; Only a single test. The target &lt;test name&gt; is called"/>
<target name="check" unless="paths.configured">
<echo message="The 'build' section in the 'build.properties' file must be configured"/>
<fail/>
</target>
<target name="init" depends="properties,check">
<taskdef name="multipleAnt"
classname="org.objectweb.util.ant.MultipleAnt"
classpath="${objectweb.ant.tasks.path}"/>
<taskdef name="javadocMultipleLink"
classname="org.objectweb.util.ant.JavadocMultipleLink"
classpath="${objectweb.ant.tasks.path}"/>
<taskdef name="multipleCopy"
classname="org.objectweb.util.ant.MultipleCopy"
classpath="${objectweb.ant.tasks.path}"/>
<path id="classpath">
<pathelement location="${out.build}"/>
</path>
</target>
<!-- =================================== -->
<!-- ========== COMPILE ========== -->
<!-- =================================== -->
<target name="compile">
<target name="compile" depends="init">
<mkdir dir="${out.build}"/>
<javac destdir="${out.build}" optimize="on">
<classpath refid="classpath"/>
......@@ -131,84 +119,31 @@
<!-- ========== TEST ========== -->
<!-- =================================== -->
<target name="test" depends="compile" description="Run tests">
<target name="test" depends="compile">
<ant antfile="${test}/build.xml" target="test" inheritRefs="true"/>
</target>
<!-- =================================== -->
<!-- ========== EXAMPLES ========== -->
<!-- =================================== -->
<target name="example" depends="jar">
<condition property="examples.dir.exist">
<available file="${examples}"/>
</condition>
<antcall target="dist.examples"/>
<ant
inheritAll="false"
dir="${out.dist.examples}/${example.name}"
target="execute"/>
</target>
<!-- =================================== -->
<!-- ========== WEB ========== -->
<!-- =================================== -->
<target name="web">
<ant dir="${web}"/>
</target>
<!-- =================================== -->
<!-- ========== DIST ========== -->
<!-- =================================== -->
<!-- Produce a distribution (jars, javadocs, examples and scripts) -->
<target name="dist">
<target name="dist.init">
<mkdir dir="${out.dist}"/>
<mkdir dir="${out.dist.doc}"/>
<!-- create a zip of the src directory, in the dist directory -->
<zip zipFile="${out.dist}/src.zip" basedir="${src}"/>
<!-- copy all files and all non empty directories available in the doc -->
<!-- directory into dist/doc -->
<!--copy todir="${out.dist.doc}"
preservelastmodified="yes"
includeEmptyDirs="false">
<fileset dir="${doc}">
<include name="**/*"/>
<exclude name="**/*.fig"/>
</fileset>
</copy-->
<!-- create all jars -->
<antcall target="jar"/>
<!-- create all javadoc-->
<antcall target="jdoc"/>
<!-- distribute the examples if they exist -->
<condition property="examples.dir.exist">
<available file="${examples}"/>
</condition>
<antcall target="dist.examples"/>
<mkdir dir="${out.dist.jdoc}"/>
<mkdir dir="${out.dist.lib}"/>
</target>
<!-- Distribute the example -->
<target name="jar" depends="dist.init,compile">
<multipleAnt dir="${archive}" />
</target>
<target name="dist.examples" if="examples.dir.exist">
<target name="jdoc" depends="init,dist.init">
<multipleAnt dir="${jdoc}" />
</target>
<target name="examples" depends="init,dist.init" if="examples.exist">
<mkdir dir="${out.dist.examples}"/>
<!-- Copy the examples -->
<copy todir="${out.dist.examples}"
preservelastmodified="yes"
includeEmptyDirs="yes">
......@@ -218,9 +153,6 @@
</fileset>
</copy>
<!-- Copy the common build.xml into each examples if a build.xml -->
<!-- doest not already exist -->
<multipleCopy file="${examples}/common/build.xml"
toDir="${out.dist.examples}"
notReplace="yes"
......@@ -230,54 +162,27 @@
<exclude name="lib"/>
</multipleCopy>
<!-- Copy the common part of the examples -->
<copy toDir="${out.dist.examples}" preservelastmodified="yes">
<fileset dir="${examples.common}">
<include name="**/*"/>
<exclude name="build.xml"/>
</fileset>
</copy>
</target>
<!-- Create a debian package -->
<target name="dist.deb" depends="jar">
<exec dir="${basedir}" executable="fakeroot" failonerror="true">
<arg value="/bin/sh"/>
<arg value="${basedir}/debian/create-package.sh"/>
<arg value="${basedir}"/>
<arg value="${out.dist.lib}"/>
<arg value="${out.build}/debian"/>
<arg value="${product.name}"/>
<arg value="${product.version}"/>
<arg value="${out.build}"/>
</exec>
</target>
<!-- calls the default target of each xml file in ${archive} directory -->
<target name="jar" depends="compile">
<mkdir dir="${out.dist.lib}"/>
<!-- copies the external libraries -->
<copy todir="${out.dist}">
<fileset dir=".">
<include name="externals/*.jar"/>
<exclude name="externals/junit.jar"/>
</fileset>
</copy>
<!-- creates the project's libraries -->
<multipleAnt dir="${archive}" />
<target name="dist" depends="jar,jdoc,examples">
<zip zipFile="${out.dist}/src.zip" basedir="${src}"/>
</target>
<!-- calls the default target of each xml file in ${jdoc} directory -->
<!-- =================================== -->
<!-- ========== EXAMPLES ========== -->
<!-- =================================== -->
<target name="jdoc">
<mkdir dir="${out.dist.jdoc}"/>
<multipleAnt dir="${jdoc}" />
<target name="example" depends="jar,examples">
<ant
inheritAll="false"
dir="${out.dist.examples}/${example.name}"
target="execute"/>
</target>
<!-- =================================== -->
......@@ -288,38 +193,76 @@
<target name="zip" depends="dist">
<mkdir dir="${out.zip}"/>
<zip zipFile="${out.zip}/${product.name}_${product.version}_src.zip">
<zipfileset dir="${basedir}" prefix="${product.name}/dev">
<tar destfile="${out.zip}/${product.name}-${product.version}.tar.gz"
compression="gzip">
<tarfileset dir="${basedir}" prefix="${product.name}-${product.version}">
<exclude name="build.config"/>
<exclude name="config/**"/>
<exclude name="config"/>
<exclude name="**/externals/**"/>
<exclude name="**/externals"/>
<exclude name="**/lib/**"/>
<exclude name="**/lib"/>
<exclude name="web/**"/>
<exclude name="web"/>
<exclude name="output/**"/>
<exclude name="web/**/*"/>
<exclude name="CVSROOT/**/*"/>
<exclude name="output"/>
<exclude name="CVSROOT/**"/>
<exclude name="CVSROOT"/>
</zipfileset>
</zip>
<zip zipFile="${out.zip}/${product.name}_${product.version}_bin.zip">
<zipfileset dir="${out.dist}" prefix="${product.name}"/>
</tarfileset>
</tar>
<zip zipFile="${out.zip}/${product.name}-${product.version}-bin.zip">
<zipfileset dir="${out.dist}" prefix="${product.name}-${product.version}"/>
</zip>
</target>
<!-- =================================== -->
<!-- ========== WEB ========== -->
<!-- =================================== -->
<target name="web">
<ant dir="${web}"/>
</target>
<!-- =================================== -->
<!-- ========== CLEAN ========== -->
<!-- =================================== -->
<!-- remove all directories -->
<target name="clean">
<target name="clean.web" if="web.exist">
<ant dir="${web}" target="clean"/>
</target>
<target name="clean" depends="properties,clean.web">
<delete dir="${out.build}"/>
<delete dir="${out.dist}"/>
<delete dir="${out.zip}"/>
<delete dir="${out.test}"/>
<condition property="web.exist">
<available file="${web}/build.xml"/>
</condition>
<antcall target="clean.web"/>
</target>
<target name="clean.web" if="web.exist">
<ant dir="${web}" target="clean"/>
<!-- ==================================== -->
<!-- ========== HELP ========== -->
<!-- ==================================== -->
<target name="help">
<echo message="The available targets are the following:"/>
<echo message=" compile: compiles the product into ${out.build}"/>
<echo message=" dist: creates the product's distributions into ${out.dist}"/>
<echo message=" zip: creates the product's distributions zip files into ${out.zip}"/>
<echo message=" clean: removes all generated files."/>
<echo message=" jar: creates all jars in ${out.dist.lib}"/>
<echo message=" test: run all tests"/>
<echo message=""/>
<echo message="There are some options to run tests:"/>
<echo message=" -Dtest.group=&lt;group name&gt; Only a group of test: The default target of"/>
<echo message=" the xml file is called the test.group contains the xml file name with"/>
<echo message=" directory ex: ant -Dtest.group=conform/toto test =&gt; calls the default"/>
<echo message=" target of the file ${test}/conform/toto.xml"/>
<echo message=" -Dtest.type=&lt;type name&gt; Only a type of test: conform, deviance, stress,"/>
<echo message=" thread or perf. The test.type properties contains the directory name of"/>
<echo message=" the test type ex: ant -Dtest.type=conform test"/>
<echo message=" -Dtest.name=&lt;test name&gt; Only a single test. The target &lt;test name&gt; is called"/>
</target>
</project>
This directory contains the files needed for the compilation stage.
In particular the ow_util_ant_tasks.jar contains several objectweb
tasks which are used in the build.xml files.
This directory contains the external libraries required for building the
product, but which are not necessary to use it.
#!/bin/sh
# Constructs a Debian package containing the project's jar files.
# Authors: Romain Lenglet <romain.lenglet@rd.francetelecom.com>
# Eric Bruneton <eric.bruneton@rd.francetelecom.com>
# This script takes six arguments:
# - the project base directory
# - the directory that contains the jar files to be included into the package
# - the root directory to be used to construct the package files
# - the project name
# - the project version
# - the directory into which the debian package file must be put
BASE_DIR="$1"
LIBS_DIR="$2"
DEST_DIR="$3"
PROJECT_NAME="$4"
PROJECT_VERSION="$5"
BUILD_DIR="$6"
rm -Rf "${DEST_DIR}"
mkdir "${DEST_DIR}"
mkdir "${DEST_DIR}/usr"
mkdir "${DEST_DIR}/usr/share"
echo "Preparing library files..."
mkdir "${DEST_DIR}/usr/share/java"
cp "${LIBS_DIR}"/*.jar "${DEST_DIR}/usr/share/java"
(
cd "${DEST_DIR}/usr/share/java"
for FILE in *.jar
do
NAME=`echo ${FILE} | sed -e 's/\(.*\).jar/\1/'`
mv "${NAME}.jar" "${NAME}-${PROJECT_VERSION}.jar"
ln -s "${NAME}-${PROJECT_VERSION}.jar" "${NAME}.jar"
done
)
echo "Preparing documentation files..."
mkdir "${DEST_DIR}/usr/share/doc"
mkdir "${DEST_DIR}/usr/share/doc/${PROJECT_NAME}"
cp -r "${BASE_DIR}/debian/files/doc"/* "${DEST_DIR}/usr/share/doc/${PROJECT_NAME}"
echo "Preparing package control files..."
mkdir "${DEST_DIR}/DEBIAN"
cp -r "${BASE_DIR}/debian/files/control"/* "${DEST_DIR}/DEBIAN"
echo "Removing CVS files..."
find "${DEST_DIR}" -path "*/CVS" -prune -exec rm -Rf {} \;
echo "Preparing file rights..."
chmod 755 `find "${DEST_DIR}" -type d`
chmod 644 `find "${DEST_DIR}" -type f`
echo "Creating debian package..."
dpkg-deb -b "${DEST_DIR}" "${BUILD_DIR}" > /dev/null
echo "Removing temporary files..."
rm -Rf "${DEST_DIR}"
echo "Debian package created"
Package: libasm-java
Version: 1.4.1
Architecture: all
Section: contrib
Priority: optional
Depends: java1-runtime
Maintainer: Eric BRUNETON <eric.bruneton@rd.francetelecom.com>
Description: ASM is a Java bytecode manipulation framework.
It can be used to dynamically generate stub classes or other proxy
classes, directly in binary form, or to dynamically modify classes
at load time, i.e., just before they are loaded into the Java
Virtual Machine.
.
ASM offers similar functionalities as BCEL or SERP, but is much
more smaller (22KB instead of 350KB for BCEL and 150KB for SERP)
and faster than these tools (the overhead of a load time class
transformation is of the order of 60% with ASM, 700% or more with
BCEL, and 1100% or more with SERP). Indeed ASM was designed to be
used in a dynamic way and was therefore designed and implemented
to be as small and as fast as possible.
Copyright (C) 2000 INRIA, France Telecom
Copyright (C) 2002 France Telecom