blob: f0ffe82f207262662454584d769c4b28f1df5e0b [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE project [
<!ENTITY libsets '
<libset libs="${apr-util.lib.prefix}${apr-util.lib.name}${apr-util.lib.suffix}"
dir="${apr-util.lib.dir}"
if="apr-util.lib.dir"
/>
<libset libs="${apr-util.lib.prefix}${apr-util.lib.name}${apr-util.lib.suffix}"
unless="apr-util.lib.dir"
/>
<libset libs="${apr.lib.prefix}${apr.lib.name}${apr.lib.suffix}"
dir="${apr.lib.dir}"
if="apr.lib.dir"
/>
<libset libs="${apr.lib.prefix}${apr.lib.name}${apr.lib.suffix}"
unless="apr.lib.dir"
/>
<libset libs="esmtp"
dir="${esmtp.lib.dir}"
if="esmtp.lib.dir"
/>
<libset libs="esmtp"
if="has-libesmtp"
unless="esmtp.lib.dir"
/>
<libset libs="${odbc.lib}"
if="odbc.lib"
/>
<libset libs="${apr-util.dependencies}"
if="apr-util.dependencies"
unless="apr-util-includes-dependencies"
/>
<libset libs="pthread"
if="is-unix"
/>
<syslibset libs="advapi32 mswsock shell32 ws2_32"
if="is-windows"
/>
<syslibset libs="stdc++"
if="is-gcc"
/>
<syslibset libs="cw32mt"
if="is-bcc"
/>
'>
<!ENTITY license '
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'>
<!ENTITY common SYSTEM 'src/ant/common.xml'>
<!ENTITY find-apr SYSTEM 'src/ant/find-apr.xml'>
<!ENTITY find-apr-util SYSTEM 'src/ant/find-apr-util.xml'>
<!ENTITY find-libesmtp SYSTEM 'src/ant/find-libesmtp.xml'>
]>
<!--
This file builds log4cxx using Apache Ant (http://ant.apache.org)
and the C++ compilation tasks from http://ant-contrib.sourceforge.net.
-->
<project name="log4cxx" default="check">
&common;
&find-apr;
&find-apr-util;
&find-libesmtp;
<property name="base.dir"
location="."
/>
<property name="src.dir"
location="${base.dir}/src/main/cpp"
/>
<property name="resources.dir"
location="${base.dir}/src/main/resources"
/>
<property name="include.dir"
location="${base.dir}/src/main/include"
/>
<property name="target.dir"
location="${base.dir}/target"
/>
<property name="lib.dir"
location="${target.dir}/lib"
/>
<property name="examples.dir"
location="${base.dir}/src/examples/cpp"
/>
<property name="tests.dir"
location="${base.dir}/src/test"
/>
<property name="tests.cpp.dir"
location="${tests.dir}/cpp"
/>
<property name="tests.resources.dir"
location="${tests.dir}/resources"
/>
<property name="tests.output.dir"
location="${tests.resources.dir}/output"
/>
<property name="m2_repo"
location="${user.home}/.m2/repository"
/>
<property name="log4j.version"
value="1.2.14"
/>
<available property="log4j.jar"
value="/usr/share/java/log4j-1.2.jar"
file="/usr/share/java/log4j-1.2.jar"
/>
<property name="log4j.jar"
location="${m2_repo}/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar"
/>
<property name="doxygen.exe"
value="doxygen"
/>
<property name="lib.name"
value="${project.groupId}"
/>
<property name="lib.prefix"
value=""
/>
<property name="enable-char"
value="1"
/>
<property name="enable-wchar_t"
value="1"
/>
<property name="enable-unichar"
value="0"
/>
<property name="enable-cfstring"
value="0"
/>
<property name="with-charset"
value="auto"
/>
<property name="with-SMTP"
value="no"
/>
<property name="with-ODBC"
value="auto"
/>
<propertyregex property="version.major"
input="${project.version}"
regexp="^(\d+)"
select="\1"
/>
<propertyregex property="version.minor"
input="${project.version}"
regexp="\.(\d+)\."
select="\1"
/>
<propertyregex property="version.rev"
input="${project.version}"
regexp="(\d+)(?:-.+)?$"
select="\1"
/>
<propertyregex property="version.hasSuffix"
input="${project.version}"
regexp="\d+-.+$"
select="\0"
/>
<property name="site.svnRepoUrl"
value="https://svn.apache.org/repos/infra/websites/production/logging/content/log4cxx"
/>
<property name="site.deployDir"
value="target/site-deploy"
/>
<property name="site.deployDir.curVersion"
value="${site.deployDir}/${project.version}"
/>
<property name="site.deployDir.curVersionWoSuffix"
value="${site.deployDir}/${version.major}.${version.minor}.${version.rev}"
/>
<target name="usage"
description="Describes usage of the build script">
<echo>
Ant build file for log4cxx
Common invocations:
> ant
will attempt to locate APR and APR-util in /usr, /usr/local/apr and ..
Builds and tests log4cxx.
> ant -Dwith-apr=APRPATH -Dwith-apr-util=APUPATH
Builds and tests log4cxx using APR and APR-Util at specified location
> ant -p
Displays available targets
> ant build-projects-vc6
Builds Microsoft Visual Studio 6 projects.
-vc7, -vc8, -vc9 and -xcode for Visual Studio .NET, 2005, 2008 and Apple Xcode 2 and later.
respectively.
Command line options:
-Ddebug=[true|false]
-Doptimize=[speed|size|none]
-Dversion=n.n.n
-Dlib.type=[shared|static] (Library type to create, default=shared)
-Denable-char=[0, 1] (expose char* API, default=1)
-Denable-wchar_t=[0, 1] (expose wchar_t* API, default=1)
-Denable-unichar=[0, 1] (expose UniChar API, default=0)
-Denable-cfstring[0, 1] (expose CFString API, default=0)
-Dwith-charset=[auto|utf-8|iso-8859-1|usascii|ebcdic] (default=auto)
-Dwith-logchar=[utf-8|wchar_t|unichar] (default=utf-8 on Unix, wchar_t on Windows)
-Dwith-apr=APRPATH
-Dwith-apr-util=PATH
-Dwith-SMTP=[libesmtp, no] (default no)
-Dwith-ODBC=[auto, unixODBC, iODBC, Microsoft, no] (default=auto resulting in no on Unix, Microsoft on Windows)
</echo>
</target>
<target name="init"
depends="common-init">
<property name="log4cxx.lib.dir"
value="${executable.dir}"
/>
<mkdir dir="${log4cxx.lib.dir}" />
<condition property="with-logchar"
value="wchar_t">
<isset property="is-windows" />
</condition>
<property name="with-logchar"
value="utf-8"
/>
<condition property="has-libesmtp"
value="1">
<equals arg1="${with-SMTP}"
arg2="libesmtp"
/>
</condition>
<condition property="odbc.lib"
value="iodbc">
<equals arg1="${with-ODBC}"
arg2="iODBC"
/>
</condition>
<condition property="odbc.lib"
value="unixodbc">
<equals arg1="${with-ODBC}"
arg2="unixODBC"
/>
</condition>
<condition property="odbc.lib"
value="odbc32">
<and>
<not>
<equals arg1="${with-ODBC}"
arg2="no"
/>
</not>
<isset property="is-windows" />
</and>
</condition>
<condition property="has-ODBC"
value="1">
<isset property="odbc.lib" />
</condition>
<property name="has-ODBC"
value="0"
/>
<condition property="force-ant"
value="1">
<equals arg1="${find}"
arg2="false"
/>
</condition>
<echo>force-ant: ${force-ant}</echo>
</target>
<target name="clean"
depends="init"
description="Removes built files">
<delete dir="${target.dir}" />
<delete>
<fileset dir="${include.dir}/log4cxx"
includes="**/log4cxx.h"
/>
</delete>
</target>
<target name="unix-configure"
if="is-unix">
<copy tofile="${include.dir}/log4cxx/log4cxx.tmp"
file="${include.dir}/log4cxx/log4cxx.h.in"
overwrite="true"
/>
<copy tofile="${include.dir}/log4cxx/private/log4cxx_private.tmp"
file="${include.dir}/log4cxx/private/log4cxx_private.h.in"
overwrite="true"
/>
</target>
<target name="win-configure"
if="is-windows">
<copy tofile="${include.dir}/log4cxx/log4cxx.tmp"
file="${include.dir}/log4cxx/log4cxx.hw"
overwrite="true"
/>
<copy tofile="${include.dir}/log4cxx/private/log4cxx_private.tmp"
file="${include.dir}/log4cxx/private/log4cxx_private.hw"
overwrite="true"
/>
</target>
<target name="configure"
depends="init, unix-configure, win-configure">
<echo message="Configuring with-logchar=${with-logchar}" />
<echo message="Configuring with-charset=${with-charset}" />
<echo message="Configuring with-SMTP=${with-SMTP}" />
<echo message="Configuring with-ODBC=${with-ODBC}" />
<echo message="Configuring enable-char=${enable-char}" />
<echo message="Configuring enable-wchar_t=${enable-wchar_t}" />
<echo message="Configuring enable-unichar=${enable-unichar}" />
<echo message="Configuring enable-cfstring=${enable-cfstring}" />
<condition property="logchar_is_utf8"
value="1">
<equals arg1="${with-logchar}"
arg2="utf-8"
/>
</condition>
<property name="logchar_is_utf8"
value="0"
/>
<condition property="logchar_is_unichar"
value="1">
<equals arg1="${with-logchar}"
arg2="unichar"
/>
</condition>
<property name="logchar_is_unichar"
value="0"
/>
<condition property="logchar_is_wchar"
value="1">
<equals arg1="${with-logchar}"
arg2="wchar_t"
/>
</condition>
<property name="logchar_is_wchar"
value="0"
/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
match="@LOGCHAR_IS_UNICHAR@"
replace="${logchar_is_unichar}"
/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
match="@LOGCHAR_IS_UTF8@"
replace="${logchar_is_utf8}"
/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
match="@LOGCHAR_IS_WCHAR@"
replace="${logchar_is_wchar}"
/>
<condition property="charset_is_utf8"
value="1">
<equals arg1="${with-charset}"
arg2="utf-8"
/>
</condition>
<property name="charset_is_utf8"
value="0"
/>
<condition property="charset_is_iso-8859-1"
value="1">
<equals arg1="${with-charset}"
arg2="iso-8859-1"
/>
</condition>
<property name="charset_is_iso-8859-1"
value="0"
/>
<condition property="charset_is_usascii"
value="1">
<equals arg1="${with-charset}"
arg2="usascii"
/>
</condition>
<property name="charset_is_usascii"
value="0"
/>
<condition property="charset_is_ebcdic"
value="1">
<equals arg1="${with-charset}"
arg2="ebcdic"
/>
</condition>
<property name="charset_is_ebcdic"
value="0"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@CHARSET_UTF8@"
replace="${charset_is_utf8}"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@CHARSET_ISO88591@"
replace="${charset_is_iso-8859-1}"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@CHARSET_USASCII@"
replace="${charset_is_usascii}"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@CHARSET_EBCDIC@"
replace="${charset_is_ebcdic}"
/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
match="@CHAR_API@"
replace="${enable-char}"
/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
match="@WCHAR_T_API@"
replace="${enable-wchar_t}"
/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
match="@UNICHAR_API@"
replace="${enable-unichar}"
/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
match="@CFSTRING_API@"
replace="${enable-cfstring}"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@HAS_SYSLOG@"
replace="1"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@HAS_STD_LOCALE@"
replace="1"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@HAS_MBSRTOWCS@"
replace="1"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@HAS_WCSTOMBS@"
replace="1"
/>
<condition property="has-fwide" value="0">
<isset property="is-cygwin" />
</condition>
<property name="has-fwide"
value="1"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@HAS_FWIDE@"
replace="${has-fwide}"
/>
<condition property="has-libesmtp-value" value="1">
<isset property="has-libesmtp" />
</condition>
<property name="has-libesmtp-value"
value="0"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="LOG4CXX_HAVE_LIBESMTP 0"
replace="LOG4CXX_HAVE_LIBESMTP ${has-libesmtp-value}"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@HAS_LIBESMTP@"
replace="${has-libesmtp-value}"
/>
<replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
match="@HAS_ODBC@"
replace="${has-ODBC}"
/>
<antcall target="copy-if-changed">
<param name="tofile"
value="${include.dir}/log4cxx/log4cxx.h"
/>
<param name="file"
value="${include.dir}/log4cxx/log4cxx.tmp"
/>
</antcall>
<delete file="${include.dir}/log4cxx/log4cxx.tmp" />
<antcall target="copy-if-changed">
<param name="tofile"
value="${include.dir}/log4cxx/private/log4cxx_private.h"
/>
<param name="file"
value="${include.dir}/log4cxx/private/log4cxx_private.tmp"
/>
</antcall>
<delete file="${include.dir}/log4cxx/private/log4cxx_private.tmp" />
</target>
<target name="build-apr"
depends="find-apr"
unless="apr.lib.file">
<fail unless="apr.src.dir">Could not locate apr library or source.</fail>
<property name="apr.lib.type"
value="static"
/>
<property name="apr.lib.prefix"
value=""
/>
<property name="apr.lib.suffix"
value=""
/>
<property name="project.type"
value="msvc6"
/>
<ant antfile="src/ant/apr-build.xml"
target="build"
inheritAll="false">
<property name="basedir"
value="${apr.src.dir}"
/>
<property name="target.dir"
value="${target.dir}"
/>
<property name="debug"
value="${debug}"
/>
<property name="lib.prefix"
value="${apr.lib.prefix}"
/>
<property name="lib.suffix"
value="${apr.lib.suffix}"
/>
<property name="compiler"
value="${compiler}"
/>
<property name="runtime"
value="${runtime}"
/>
<property name="lib.type"
value="${apr.lib.type}"
/>
<property name="project.type"
value="${project.type}"
/>
<property name="projects.dir"
value="${projects.dir}"
/>
<property name="project.if.value"
value="${project.if}"
/>
<property name="use-pic"
value="${use-pic}"
/>
<property name="os.family"
value="${os.family}"
/>
</ant>
<condition property="apr.lib.dir"
value="${target.dir}/${debug.release}/shared">
<equals arg1="${apr.lib.type}"
arg2="shared"
/>
</condition>
<property name="apr.lib.dir"
location="${target.dir}/${debug.release}/static"
/>
<property name="apr.project.file"
location="${projects.dir}/apr"
/>
</target>
<target name="build-apr-util"
depends="build-apr, find-apr-util"
unless="apr-util.lib.file">
<fail unless="apr-util.src.dir">Could not locate apr-util library or source.</fail>
<property name="apr-util.lib.type"
value="${apr.lib.type}"
/>
<property name="apr-util.lib.prefix"
value=""
/>
<property name="apr-util.lib.suffix"
value=""
/>
<property name="project.type"
value="msvc6"
/>
<!-- built this way, apr-util will include expat and doesn't need an external reference -->
<property name="apr-util-includes-dependencies"
value="1"
/>
<ant antfile="src/ant/apr-util-build.xml"
target="build"
inheritAll="false">
<property name="target.dir"
value="${target.dir}"
/>
<property name="basedir"
value="${apr-util.src.dir}"
/>
<property name="debug"
value="${debug}"
/>
<property name="lib.prefix"
value="${apr-util.lib.prefix}"
/>
<property name="lib.suffix"
value="${apr-util.lib.suffix}"
/>
<property name="compiler"
value="${compiler}"
/>
<property name="runtime"
value="${runtime}"
/>
<property name="apr.include.dir"
value="${apr.include.dir}"
/>
<property name="apr.lib.dir"
value="${apr.lib.dir}"
/>
<property name="apr.lib.type"
value="${apr.lib.type}"
/>
<property name="lib.type"
value="${apr-util.lib.type}"
/>
<property name="project.type"
value="${project.type}"
/>
<property name="projects.dir"
value="${projects.dir}"
/>
<property name="project.if.value"
value="${project.if}"
/>
<property name="use-pic"
value="${use-pic}"
/>
<property name="os.family"
value="${os.family}"
/>
</ant>
<condition property="apr-util.lib.dir"
value="${target.dir}/${debug.release}/shared">
<equals arg1="${apr-util.lib.type}"
arg2="shared"
/>
</condition>
<property name="apr-util.lib.dir"
location="${target.dir}/${debug.release}/static"
/>
<property name="apr-util.project.file"
location="${projects.dir}/apr-util"
/>
</target>
<target name="build-libesmtp"
depends="find-esmtp"
if="has-libesmtp"
unless="esmtp.lib.file">
<fail unless="esmtp.src.dir">Could not locate libesmtp library or source.</fail>
<property name="esmtp.lib.type"
value="static"
/>
<property name="esmtp.lib.prefix"
value=""
/>
<property name="esmtp.lib.suffix"
value=""
/>
<property name="project.type"
value="msvc6"
/>
<condition property="esmtp.compiler"
value="gcc">
<equals arg1="${compiler}"
arg2="g++"
/>
</condition>
<property name="esmtp.compiler"
value="${compiler}"
/>
<ant antfile="src/ant/esmtp-build.xml"
target="build"
inheritAll="false">
<property name="target.dir"
value="${target.dir}"
/>
<property name="basedir"
value="${esmtp.src.dir}"
/>
<property name="debug"
value="${debug}"
/>
<property name="lib.prefix"
value="${esmtp.lib.prefix}"
/>
<property name="lib.suffix"
value="${esmtp.lib.suffix}"
/>
<property name="compiler"
value="${esmtp.compiler}"
/>
<property name="runtime"
value="${runtime}"
/>
<property name="lib.type"
value="${esmtp.lib.type}"
/>
<property name="project.type"
value="${project.type}"
/>
<property name="projects.dir"
value="${projects.dir}"
/>
<property name="project.if.value"
value="${project.if}"
/>
<property name="use-pic"
value="${use-pic}"
/>
<property name="os.family"
value="${os.family}"
/>
</ant>
<condition property="esmtp.lib.dir"
value="${target.dir}/${debug.release}/shared">
<equals arg1="${esmtp.lib.type}"
arg2="shared"
/>
</condition>
<property name="esmtp.lib.dir"
location="${target.dir}/${debug.release}/static"
/>
<property name="esmtp.project.file"
location="${projects.dir}/libesmtp"
/>
</target>
<target name="make-header-check">
<echo file="${header}.cpp"
append="false">
#include "${header}"
#include "${header}"
</echo>
</target>
<target name="header-check"
depends="build-apr-util, configure"
description="Checks headers against Effective C++ guidelines">
<fail unless="is-gcc">Requires GCC compiler</fail>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<delete dir="${target.dir}/header-check" />
<mkdir dir="${target.dir}/header-check" />
<copy todir="${target.dir}/header-check"
overwrite="true">
<fileset dir="${include.dir}"
includes="**/*.h">
<!-- obsolete header with #error directive to eliminate its use -->
<exclude name="**/tchar.h" />
<!-- excluded due to conflict between log4cxx/rfa.h and log4cxx/rolling/rfa.h -->
<exclude name="log4cxx/rollingfileappender.h" />
</fileset>
</copy>
<foreach target="make-header-check"
param="header">
<path>
<fileset dir="${target.dir}/header-check"
includes="**/*.h"
/>
</path>
</foreach>
<property name="project.type"
value="msvc6"
/>
<cc objdir="${target.dir}/header-check"
name="gcc"
exceptions="true"
subsystem="gui"
optimize="${optimize}"
multithreaded="true"
relentless="true"
debug="${debug}"
projectsOnly="${projectsOnly}">
<compilerarg value="-Weffc++"
/>
<compilerarg value="-Wall"
/>
<compilerarg value="${pic-option}"
if="pic-option"
/>
<fileset dir="${target.dir}/header-check"
includes="**/*.cpp"
excludes="log4cxx/private/*.cpp **/aprinitializer.h.cpp"
/>
<includepath path="${include.dir}" />
<project outfile="${projects.dir}/projects/header-check"
type="${project.type}"
if="project.if"
/>
</cc>
</target>
<target name="update-rc-files-version-info"
description="Provides current version information for Windows resource files."
if="is-windows"
unless="is-bcc">
<replaceregexp file="${resources.dir}/log4cxx.rc"
match="FILEVERSION \d+, \d+, \d+, \d+"
replace="FILEVERSION ${version.major}, ${version.minor}, 0, ${version.rev}"
/>
<replaceregexp file="${resources.dir}/log4cxx.rc"
match="PRODUCTVERSION \d+, \d+, \d+, \d+"
replace="PRODUCTVERSION ${version.major}, ${version.minor}, 0, ${version.rev}"
/>
<replaceregexp file="${resources.dir}/log4cxx.rc"
match="&quot;FileVersion&quot;, &quot;\d+, \d+, \d+, \d+&quot;"
replace="&quot;FileVersion&quot;, &quot;${version.major}, ${version.minor}, 0, ${version.rev}&quot;"
/>
<replaceregexp file="${resources.dir}/log4cxx.rc"
match="&quot;ProductVersion&quot;, &quot;\d+, \d+, \d+, \d+&quot;"
replace="&quot;ProductVersion&quot;, &quot;${version.major}, ${version.minor}, 0, ${version.rev}&quot;"
/>
</target>
<target name="restore-rc-files-version-info"
description="Restores version information for Windows resource files to their default values."
if="is-windows"
unless="is-bcc">
<replaceregexp file="${resources.dir}/log4cxx.rc"
match="FILEVERSION \d+, \d+, \d+, \d+"
replace="FILEVERSION 0, 0, 0, 0"
/>
<replaceregexp file="${resources.dir}/log4cxx.rc"
match="PRODUCTVERSION \d+, \d+, \d+, \d+"
replace="PRODUCTVERSION 0, 0, 0, 0"
/>
<replaceregexp file="${resources.dir}/log4cxx.rc"
match="&quot;FileVersion&quot;, &quot;\d+, \d+, \d+, \d+&quot;"
replace="&quot;FileVersion&quot;, &quot;0, 0, 0, 0&quot;"
/>
<replaceregexp file="${resources.dir}/log4cxx.rc"
match="&quot;ProductVersion&quot;, &quot;\d+, \d+, \d+, \d+&quot;"
replace="&quot;ProductVersion&quot;, &quot;0, 0, 0, 0&quot;"
/>
</target>
<target name="build-lib"
depends="build-apr-util, build-libesmtp, configure"
description="Build log4cxx library">
<mkdir dir="${log4cxx.lib.dir}/log4cxx_obj" />
<condition property="apr-static"
value="1">
<equals arg1="${apr.lib.type}"
arg2="static"
/>
</condition>
<condition property="apr-util-static"
value="1">
<equals arg1="${apr-util.lib.type}"
arg2="static"
/>
</condition>
<condition property="apr-libs-match"
value="1">
<equals arg1="${apr.lib.type}"
arg2="${apr-util.lib.type}"
/>
</condition>
<fail unless="apr-libs-match">
apr is ${apr.lib.type} and apr-util is ${apr-util.lib.type}, must be same type.
</fail>
<property name="lib.name"
value="log4cxx"
/>
<property name="lib.prefix"
value=""
/>
<property name="lib.suffix"
value=""
/>
<condition property="apr-util.dependencies"
value="expat iconv">
<equals arg1="${apr-util.lib.type}"
arg2="static"
/>
</condition>
<property name="project.compiler"
value="${compiler}"
/>
<property name="project.type"
value="msvc6"
/>
<condition property="resource.compiler"
value="windres">
<isset property="is-gcc" />
</condition>
<condition property="resource.compiler"
value="brc">
<isset property="is-bcc" />
</condition>
<property name="resource.compiler"
value="msrc"
/>
<antcall target="update-rc-files-version-info" />
<cc name="${project.compiler}"
exceptions="true"
outfile="${log4cxx.lib.dir}/${lib.prefix}${lib.name}${lib.suffix}"
outputfileproperty="log4cxx.lib.file"
subsystem="console"
multithreaded="true"
runtime="${runtime}"
outtype="${lib.type}"
objdir="${log4cxx.lib.dir}/log4cxx_obj"
debug="${debug}"
projectsOnly="${projectsOnly}"
failonerror="true">
<!-- brc aborts with an access violation. -->
<compiler name="${resource.compiler}"
if="is-windows"
unless="is-bcc">
<includepath path="${resources.dir}" />
<fileset dir="${resources.dir}"
includes="*.rc"
/>
</compiler>
<fileset dir="${src.dir}"
includes="*.cpp"
/>
<fileset dir="${include.dir}"
includes="**/*.h"
/>
<includepath path="${include.dir}"
/>
<includepath path="${apr.include.dir}"
if="apr.include.dir"
/>
<includepath path="${apr-util.include.dir}"
if="apr-util.include.dir"
/>
<includepath path="${esmtp.include.dir}"
if="esmtp.include.dir"
/>
<defineset define="LOG4CXX"
/>
<defineset define="LOG4CXX_STATIC"
if="is-static"
/>
<defineset define="APR_DECLARE_STATIC"
if="apr-static"
/>
<defineset define="APU_DECLARE_STATIC"
if="apr-util-static"
/>
<defineset define="WIN32 _USRDLL DLL_EXPORTS"
if="is-windows"
/>
<compilerarg value="${pic-option}"
if="pic-option"
/>
&libsets;
<project type="${project.type}"
outfile="${projects.dir}/projects/${lib.name}"
if="project.if">
<comment>&license;</comment>
<dependency file="${projects.dir}/apr" />
<dependency file="${projects.dir}/xml" />
<dependency file="${projects.dir}/aprutil" depends="apr,xml" />
<dependency name="${projects.dir}/libesmtp" />
</project>
</cc>
<antcall target="restore-rc-files-version-info" />
<!-- copy liblog4cxx.so to log4cxx.dll for MinGW and Cygwin -->
<condition property="copy.log4cxx"
value="${log4cxx.lib.dir}/${lib.prefix}${lib.name}${lib.suffix}.dll">
<and>
<os family="windows" />
<isset property="is-gcc" />
<equals arg1="${lib.type}" arg2="shared" />
<isset property="log4cxx.lib.file" />
</and>
</condition>
</target>
<target name="build"
depends="build-lib"
if="copy.log4cxx">
<copy file="${log4cxx.lib.file}"
tofile="${copy.log4cxx}"
overwrite="true"
preservelastmodified="true"
/>
</target>
<target name="build-example">
<mkdir dir="${log4cxx.lib.dir}/${example.name}_obj" />
<property name="project.compiler"
value="${compiler}"
/>
<property name="project.type"
value="msvc6"
/>
<property name="example.include.dir"
value="${example.src.dir}"
/>
<cc name="${project.compiler}"
exceptions="true"
outfile="${log4cxx.lib.dir}/${example.name}"
subsystem="console"
multithreaded="true"
runtime="${runtime}"
outtype="executable"
objdir="${log4cxx.lib.dir}/${example.name}_obj"
debug="${debug}"
projectsOnly="${projectsOnly}">
<fileset dir="${example.src.dir}"
includes="${example.includes}"
/>
<includepath path="${include.dir}" />
<includepath path="${example.include.dir}" />
<includepath path="${apr.include.dir}" if="apr.include.dir" />
<defineset define="WIN32"
if="is-windows"
/>
<defineset define="LOG4CXX_STATIC"
if="is-static"
/>
<defineset define="APR_DECLARE_STATIC"
if="apr-static"
/>
<compilerarg value="${pic-option}" if="pic-option" />
<libset libs="${lib.prefix}${lib.name}${lib.suffix}"
dir="${log4cxx.lib.dir}"
/>
&libsets;
<project outfile="${projects.dir}/projects/${example.name}"
type="${project.type}"
if="project.if">
<comment>&license;</comment>
<dependency file="${projects.dir}/apr" />
<dependency file="${projects.dir}/xml" />
<dependency name="${projects.dir}/aprutil" depends="apr,xml" />
<dependency name="${projects.dir}/libesmtp" />
<dependency file="${projects.dir}/log4cxx" depends="apr,aprutil,xml" />
</project>
</cc>
</target>
<target name="run-example">
<!-- remove any stray configuration files -->
<delete>
<fileset dir="${log4cxx.lib.dir}"
includes="log4*.properties log4*.xml"
/>
</delete>
<exec executable="${log4cxx.lib.dir}/${example.name}"
dir="${log4cxx.lib.dir}"
failonerror="true">
<env key="DYLD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"
/>
<env key="LD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"
/>
<env key="Path"
value="${env.Path}"
/>
</exec>
</target>
<target name="build-delayedloop"
depends="build">
<antcall target="build-example">
<param name="example.src.dir"
value="${examples.dir}"
/>
<param name="example.name"
value="delayedloop"
/>
<param name="example.includes"
value="delayedloop.cpp"
/>
</antcall>
</target>
<target name="build-trivial"
depends="build">
<antcall target="build-example">
<param name="example.src.dir"
value="${examples.dir}"
/>
<param name="example.name"
value="trivial"
/>
<param name="example.includes"
value="trivial.cpp"
/>
</antcall>
</target>
<target name="build-console"
depends="build">
<antcall target="build-example">
<param name="example.src.dir"
value="${examples.dir}"
/>
<param name="example.name"
value="console"
/>
<param name="example.includes"
value="console.cpp"
/>
</antcall>
</target>
<target name="build-stream"
depends="build">
<antcall target="build-example">
<param name="example.src.dir"
value="${examples.dir}"
/>
<param name="example.name"
value="stream"
/>
<param name="example.includes"
value="stream.cpp"
/>
</antcall>
</target>
<target name="build-examples"
depends="build-delayedloop, build-trivial, build-stream, build-console"
description="Builds example programs"
/>
<target name="build-unittest"
depends="build"
description="Builds unit test app">
<mkdir dir="${log4cxx.lib.dir}/testsuite_obj" />
<property name="project.compiler"
value="${compiler}"
/>
<property name="project.type"
value="msvc6"
/>
<cc name="${project.compiler}"
exceptions="true"
outfile="${log4cxx.lib.dir}/testsuite"
subsystem="console"
multithreaded="true"
runtime="${runtime}"
outputfileproperty="testsuite.exe"
outtype="executable"
objdir="${log4cxx.lib.dir}/testsuite_obj"
debug="${debug}"
projectsOnly="${projectsOnly}"
failonerror="true">
<fileset dir="${tests.cpp.dir}"
includes="**/*.cpp **/*.c **/*.h"
/>
<includepath path="${include.dir}"
/>
<includepath path="${apr.include.dir}"
if="apr.include.dir"
/>
<includepath path="${apr-util.include.dir}"
if="apr-util.include.dir"
/>
<defineset define="LOG4CXX_STATIC"
if="is-static"
/>
<defineset define="APR_DECLARE_STATIC"
if="apr-static"
/>
<defineset define="APU_DECLARE_STATIC"
if="apr-util-static"
/>
<defineset define="WIN32"
if="is-windows"
/>
<compilerarg value="${pic-option}"
if="pic-option"
/>
<libset libs="${lib.prefix}${lib.name}${lib.suffix}"
dir="${log4cxx.lib.dir}"
/>
&libsets;
<project outfile="${projects.dir}/projects/testsuite"
type="${project.type}"
if="project.if">
<comment>&license;</comment>
<dependency file="${projects.dir}/apr" />
<dependency file="${projects.dir}/xml" />
<dependency file="${projects.dir}/aprutil" depends="apr,xml" />
<dependency name="${projects.dir}/libesmtp" />
<dependency file="${projects.dir}/log4cxx" depends="apr,aprutil,libesmtp" />
</project>
</cc>
</target>
<target name="build-standalone-unittest"
description="Builds a unit tests + log4cxx executable"
depends="build-apr-util, build-libesmtp, configure">
<mkdir dir="${executable.dir}/static/testsuite-standalone_obj" />
<property name="project.compiler"
value="${compiler}"
/>
<property name="project.type"
value="msvc6"
/>
<condition property="resource.compiler"
value="windres">
<isset property="is-gcc" />
</condition>
<property name="resource.compiler"
value="msrc"
/>
<cc name="${project.compiler}"
exceptions="true"
outfile="${executable.dir}/static/testsuite-standalone"
subsystem="console"
multithreaded="true"
runtime="${runtime}"
outputfileproperty="testsuite-standalone.exe"
outtype="executable"
objdir="${executable.dir}/static/testsuite-standalone_obj"
debug="${debug}"
projectsOnly="${projectsOnly}">
<compiler name="${resource.compiler}"
if="is-windows">
<includepath path="${resources.dir}" />
<fileset dir="${resources.dir}"
includes="*.rc"
/>
</compiler>
<fileset dir="${src.dir}"
includes="*.cpp"
excludes="**/iconv_module.cpp"
/>
<fileset dir="${include.dir}"
includes="**/*.h"
/>
<fileset dir="${tests.cpp.dir}"
includes="**/*.cpp **/*.c **/*.h"
/>
<includepath path="${include.dir}" />
<includepath path="${apr.include.dir}"
if="apr.include.dir"
/>
<includepath path="${apr-util.include.dir}"
if="apr-util.include.dir"
/>
<includepath path="${esmtp.include.dir}"
if="esmtp.include.dir"
/>
<defineset define="LOG4CXX"
/>
<defineset define="APR_DECLARE_STATIC"
if="apr-static"
/>
<defineset define="APU_DECLARE_STATIC"
if="apr-util-static"
/>
<defineset define="WIN32"
if="is-windows"
/>
<compilerarg value="${pic-option}"
if="pic-option"
/>
&libsets;
<includepath path="${include.dir}" />
<includepath path="${apr.include.dir}" />
<defineset define="LOG4CXX" />
<libset libs="cw32mt" if="is-bcc" />
<project outfile="${projects.dir}/projects/testsuite-standalone"
type="${project.type}"
if="project.if">
<comment>&license;</comment>
<dependency file="${projects.dir}/apr" />
<dependency file="${projects.dir}/xml" />
<dependency file="${projects.dir}/aprutil" depends="apr,xml" />
<dependency name="${projects.dir}/libesmtp" />
</project>
</cc>
</target>
<target name="build-all"
depends="build-examples, build-unittest"
description="Builds all artifacts"
/>
<target name="clean-output"
depends="init">
<delete>
<fileset dir="${tests.dir}"
includes="output/*"
/>
</delete>
</target>
<target name="run-defaultinit-unittest"
depends="build-unittest">
<antcall target="run-defaultinit-log4X">
<param name="config"
value="log4j"
/>
</antcall>
<antcall target="run-defaultinit-log4X">
<param name="config"
value="log4cxx"
/>
</antcall>
</target>
<target name="run-defaultinit-log4X">
<mkdir dir="${tests.output.dir}" />
<!-- test of log4j.properties -->
<delete>
<fileset dir="${log4cxx.lib.dir}"
includes="*.properties *.xml"
/>
</delete>
<exec executable="${testsuite.exe}"
dir="${log4cxx.lib.dir}"
failonerror="true">
<arg value="-v" />
<arg value="testcase1" />
<env key="DYLD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"
/>
<env key="LD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"
/>
</exec>
<copy tofile="${log4cxx.lib.dir}/${config}.xml"
file="${tests.resources.dir}/input/xml/defaultInit.xml"
overwrite="true"
/>
<exec executable="${testsuite.exe}"
dir="${log4cxx.lib.dir}"
failonerror="true">
<arg value="-v" />
<arg value="testcase2" />
<env key="DYLD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"
/>
<env key="LD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"
/>
</exec>
<delete>
<fileset dir="${log4cxx.lib.dir}"
includes="*.properties *.xml"
/>
</delete>
<copy tofile="${log4cxx.lib.dir}/${config}.properties"
file="${tests.resources.dir}/input/defaultInit3.properties"
overwrite="true"
/>
<exec executable="${testsuite.exe}"
dir="${log4cxx.lib.dir}"
failonerror="true">
<arg value="-v" />
<arg value="testcase3" />
<env key="DYLD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"
/>
<env key="LD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"
/>
</exec>
<delete>
<fileset dir="${log4cxx.lib.dir}"
includes="*.properties *.xml"
/>
</delete>
<copy file="${tests.resources.dir}/input/xml/defaultInit.xml"
tofile="${log4cxx.lib.dir}/${config}.xml"
/>
<copy file="${tests.resources.dir}/input/defaultInit3.properties"
tofile="${log4cxx.lib.dir}/${config}.properties"
/>
<exec executable="${testsuite.exe}"
dir="${log4cxx.lib.dir}"
failonerror="true">
<arg value="-v" />
<arg value="testcase4" />
<env key="LD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"
/>
<env key="DYLD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"
/>
</exec>
<delete>
<fileset dir="${log4cxx.lib.dir}"
includes="*.properties *.xml"
/>
</delete>
</target>
<target name="run-unittest"
depends="build-unittest, run-defaultinit-unittest, clean-output"
description="Runs unit test">
<property environment="env" />
<mkdir dir="${tests.output.dir}" />
<delete>
<fileset dir="${tests.output.dir}"
includes="*"
/>
</delete>
<exec executable="${testsuite.exe}"
dir="${tests.resources.dir}"
failonerror="true">
<arg value="-v" />
<env key="TOTO"
value="wonderful"
/>
<env key="key1"
value="value1"
/>
<env key="key2"
value="value2"
/>
<env key="LD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"
/>
<env key="DYLD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"
/>
<env key="Path"
value="${log4cxx.lib.dir};${env.Path}"
/>
</exec>
<available property="dom3-status"
value=""
file="src/test/resources/output/dom&#xB3;"
/>
<available property="dom4-status"
value=""
file="src/test/resources/output/dom&#x3195;"
/>
<property name="dom3-status"
value="NOT"
/>
<property name="dom4-status"
value="NOT"
/>
<echo>output/dom&#xB3; was ${dom3-status} created in DOMTestCase::test3</echo>
<echo>output/dom&#x3195; was ${dom4-status} created in DOMTestCase::test4</echo>
</target>
<target name="run-standalone-unittest"
depends="build-standalone-unittest, clean-output"
description="Runs standalone unit test">
<property environment="env" />
<mkdir dir="${tests.output.dir}" />
<delete>
<fileset dir="${tests.output.dir}"
includes="*"
/>
</delete>
<exec executable="${log4cxx-standalone-test.exe}"
dir="${tests.resources.dir}"
failonerror="true">
<arg value="-v" />
<env key="TOTO"
value="wonderful"
/>
<env key="key1"
value="value1"
/>
<env key="key2"
value="value2"
/>
<env key="DYLD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"
/>
<env key="LD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"
/>
<env key="Path"
value="${log4cxx.lib.dir};${env.Path}"
/>
</exec>
<available property="dom3-status"
value=""
file="src/test/resources/output/dom&#xB3;"
/>
<available property="dom4-status"
value=""
file="src/test/resources/output/dom&#x3195;"
/>
<property name="dom3-status"
value="NOT"
/>
<property name="dom4-status"
value="NOT"
/>
<echo>output/dom&#xB3; was ${dom3-status} created in DOMTestCase::test3</echo>
<echo>output/dom&#x3195; was ${dom4-status} created in DOMTestCase::test4</echo>
</target>
<target name="run-socketserver"
depends="build-unittest, clean-output"
description="Runs SocketServer test">
<property environment="env" />
<mkdir dir="${tests.output.dir}" />
<delete>
<fileset dir="${tests.output.dir}"
includes="*"
/>
</delete>
<mkdir dir="target/test-classes" />
<javac srcdir="src/test/java"
includes="org/apache/log4j/net/ShortSocketServer.java"
destdir="target/test-classes"
classpath="${log4j.jar}"
/>
<parallel>
<java classname="org.apache.log4j.net.ShortSocketServer"
fork="yes" dir="src/test/resources"
classpath="target/test-classes:${log4j.jar}">
<arg value="8" />
<arg value="input/socketServer" />
</java>
<sequential>
<sleep seconds="2" />
<exec executable="${testsuite.exe}"
dir="${tests.resources.dir}"
failonerror="true">
<arg value="-v" />
<arg value="socketservertestcase" />
<env key="LD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"
/>
<env key="DYLD_LIBRARY_PATH"
value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"
/>
<env key="Path"
value="${log4cxx.lib.dir};${env.Path}"
/>
</exec>
</sequential>
</parallel>
</target>
<target name="build-projects">
<mkdir dir="${projects.dir}/projects" />
<property name="project.type"
value="msvc6"
/>
<antcall target="build-unittest">
<param name="project.if"
value="true"
/>
<param name="project.type"
value="${project.type}"
/>
<param name="project.compiler"
value="${project.compiler}"
/>
<param name="debug"
value="${debug}"
/>
<param name="projectsOnly"
value="true"
/>
<param name="os.family"
value="${os.family}"
/>
<param name="find"
value="${find}"
/>
</antcall>
<antcall target="build-standalone-unittest">
<param name="project.if"
value="true"
/>
<param name="project.type"
value="${project.type}"
/>
<param name="project.compiler"
value="${project.compiler}"
/>
<param name="debug"
value="${debug}"
/>
<param name="projectsOnly"
value="true"
/>
<param name="os.family"
value="${os.family}"
/>
<param name="find"
value="${find}"
/>
</antcall>
<antcall target="build-examples">
<param name="project.if"
value="true"
/>
<param name="project.type"
value="${project.type}"
/>
<param name="project.compiler"
value="${project.compiler}"
/>
<param name="debug"
value="${debug}"
/>
<param name="projectsOnly"
value="true"
/>
<param name="os.family"
value="${os.family}"
/>
<param name="find"
value="${find}"
/>
</antcall>
</target>
<target name="build-projects-vc6"
depends="init"
description="Builds project files for Microsoft Visual C++ 6">
<antcall target="build-projects">
<param name="project.type"
value="msvc6"
/>
<param name="project.compiler"
value="msvc"
/>
<param name="os.family"
value="windows"
/>
<param name="debug"
value="${debug}"
/>
<param name="find"
value="${find}"
/>
</antcall>
</target>
<target name="build-projects-vc7"
depends="init"
description="Builds project files for Microsoft Visual Studio .NET">
<antcall target="build-projects">
<param name="project.type"
value="msvc7"
/>
<param name="project.compiler"
value="msvc"
/>
<param name="os.family"
value="windows"
/>
<param name="debug"
value="${debug}"
/>
<param name="find"
value="${find}"
/>
</antcall>
</target>
<target name="build-projects-vc8"
depends="init"
description="Builds project files for Microsoft Visual C++ 2005">
<antcall target="build-projects">
<param name="project.type"
value="msvc8"
/>
<param name="project.compiler"
value="msvc"
/>
<param name="os.family"
value="windows"
/>
<param name="debug"
value="${debug}"
/>
<param name="find"
value="${find}"
/>
</antcall>
</target>
<target name="build-projects-vc9"
depends="init"
description="Builds project files for Microsoft Visual C++ 2008">
<antcall target="build-projects">
<param name="project.type"
value="msvc9"
/>
<param name="project.compiler"
value="msvc"
/>
<param name="os.family"
value="windows"
/>
<param name="debug"
value="${debug}"
/>
<param name="find"
value="${find}"
/>
</antcall>
</target>
<target name="build-projects-xcode"
depends="init"
description="Builds project files for Apple Xcode">
<antcall target="build-projects">
<param name="project.type"
value="xcode"
/>
<param name="project.compiler"
value="gcc"
/>
<param name="os.family"
value="mac"
/>
<param name="debug"
value="${debug}"
/>
<param name="find"
value="${find}"
/>
</antcall>
</target>
<target name="test-compile"
depends="build-unittest, build-examples"
/>
<target name="check"
depends="run-unittest, build-examples"
description="Runs all diagnostic tests">
<antcall target="run-example">
<param name="example.name"
value="trivial"
/>
</antcall>
<antcall target="run-example">
<param name="example.name"
value="stream"
/>
</antcall>
</target>
<target name="apidocs"
description="Build log4cxx manual">
<copy file="${base.dir}/src/site/doxy/Doxyfile.in"
tofile="${target.dir}/Doxyfile"
overwrite="true"
/>
<replace file="${target.dir}/Doxyfile">
<replacefilter token="@version@"
value="${project.version}"
/>
<replacefilter token="@base_dir@"
value="${base.dir}"
/>
<replacefilter token="@manual_dest@"
value="${target.dir}/site/apidocs"
/>
</replace>
<!--
Copying project site index data to apidocs index
We need some Apache boilerplate and intro in the apidocs index page and the easiest
solution seems to be to simply copy some of the contents of the project site index.
-->
<xslt in="${target.dir}/site/index.html"
out="${target.dir}/mainpage.dox"
style="${base.dir}/src/site/doxy/mainpage.dox.xsl"
force="true">
<xmlcatalog>
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
location="${base.dir}/src/site/doxy/DTDs/xhtml1-transitional.dtd"
/>
<dtd publicId="-//W3C//ENTITIES Latin 1 for XHTML//EN"
location="${base.dir}/src/site/doxy/DTDs/xhtml-lat1.ent"
/>
<dtd publicId="-//W3C//ENTITIES Symbols for XHTML//EN"
location="${base.dir}/src/site/doxy/DTDs/xhtml-symbol.ent"
/>
<dtd publicId="-//W3C//ENTITIES Special for XHTML//EN"
location="${base.dir}/src/site/doxy/DTDs/xhtml-special.ent"
/>
</xmlcatalog>
</xslt>
<mkdir dir="${target.dir}/site/apidocs" />
<exec executable="${doxygen.exe}"
dir="${target.dir}"
/>
<!--
Links to the main project site
We want links to the main project site and adding them after doxygen seems to be the
only and easiest way.
-->
<replaceregexp match="(&lt;div (?:id=&quot;projectname&quot;|class=&quot;title&quot;)&gt;)(Apache log4cxx)"
replace="\1&lt;a href=&quot;http://logging.apache.org/log4cxx&quot;&gt;\2&lt;/a&gt;"
flags="img">
<fileset dir="${target.dir}/site/apidocs">
<include name="*.html" />
</fileset>
</replaceregexp>
</target>
<target name="gen-release-projects">
<antcall target="build-projects-vc6">
<param name="find" value="false" />
</antcall>
<antcall target="build-projects-xcode">
</antcall>
<replaceregexp flags="ig"
match="ADD LINK32 .*/NOLOGO"
replace="ADD LINK32 ADVAPI32.LIB WS2_32.LIB MSWSOCK.LIB SHELL32.LIB ODBC32.LIB /NOLOGO">
<fileset dir="${target.dir}"
includes="**/*.dsp"
/>
</replaceregexp>
<replaceregexp flags="g"
match=".\\apr.dsp"
replace="..\\\\..\\\\apr\\\\apr.dsp">
<fileset dir="${target.dir}"
includes="**/*.dsw"
/>
</replaceregexp>
<replaceregexp flags="g"
match=".\\aprutil.dsp"
replace="..\\\\..\\\\apr-util\\\\aprutil.dsp">
<fileset dir="${target.dir}"
includes="**/*.dsw"
/>
</replaceregexp>
<replaceregexp flags="g"
match=".\\xml.dsp"
replace="..\\\\..\\\\apr-util\\\\xml\\\\expat\\\\lib\\\\xml.dsp">
<fileset dir="${target.dir}"
includes="**/*.dsw"
/>
</replaceregexp>
<!-- drop library search path -->
<replaceregexp flags="g"
match="&lt;string&gt;[\./]*/usr/lib&lt;/string&gt;"
replace="">
<fileset dir="${target.dir}"
includes="**/*.pbxproj"
/>
</replaceregexp>
<replace dir="${target.dir}"
includes="**/*.pbxproj"
token="/usr/include/apr-1.0"
value="/usr/include/apr-1"
/>
<replace dir="${target.dir}" includes="**/*.pbxproj"
token="MacOSX10.4u.sdk"
value="MacOSX10.5.sdk"
/>
</target>
<target name="site-text-file-cleanup">
<fixcrlf srcDir="${base.dir}/${subDir}"
tab="asis"
tablength="4"
fixlast="false"
eof="asis"
eol="unix"
includes="**/*.css **/*.html"
/>
<replaceregexp flags="mg"
match="(?: |\t)+$"
replace="">
<fileset dir="${base.dir}/${subDir}"
includes="**/*.css, **/*.html"
/>
</replaceregexp>
</target>
<target name="site"
depends="apidocs">
<antcall target="site-text-file-cleanup">
<param name="subDir"
value="target/site"
/>
</antcall>
</target>
<target name="gump"
depends="check, header-check"
/>
<target name="prepare-changes"
description="Prepares changes.xml from a JIRA issues list">
<xslt style="src/changes/changes.xslt"
in="issues.xml"
out="src/changes/changes.xml"
/>
</target>
<target name="checkout-site">
<exec executable="svn"
failonerror="true">
<arg value="co" />
<arg value="${site.svnRepoUrl}" />
<arg value="${site.deployDir}" />
</exec>
</target>
<target name="update-site">
<exec executable="svn"
dir="${site.deployDir}"
failonerror="true">
<arg value="update" />
</exec>
</target>
<target name="post-site"
depends="checkout-site, update-site"
/>
<target name="svn-mime=css">
<exec executable="svn">
<arg value="propset" />
<arg value="svn:mime-type" />
<arg value="text/css" />
<arg value="${src.css}" />
</exec>
</target>
<target name="svn-mime=html">
<exec executable="svn">
<arg value="propset" />
<arg value="svn:mime-type" />
<arg value="text/html" />
<arg value="${src.html}" />
</exec>
</target>
<!--
Was unable to get a version w/o any suffix in pom.xml/distributionManagement, guess it's a
limitation of the property interpolation used. All suggestions found in the net seem to only
work outside that section, e.g. I was able to make a shorter version available in some
phases calling ANT targets. Doesn't get me anything... So I'm dealing with the long vs.
short name here by simply renaming the folder with the long name created by maven.
This only works for SVN clients using only one ".svn" folder per working copy!
https://cwiki.apache.org/confluence/display/MAVENOLD/POM+Interpolation+Refactor
https://stackoverflow.com/a/12002359/2055163
https://gist.github.com/tux2323/970877#file-pom-xml-L24
-->
<target name="svn-shorten-dir-name"
if="version.hasSuffix">
<delete dir="${site.deployDir.curVersionWoSuffix}"
/>
<move file="${site.deployDir.curVersion}"
tofile="${site.deployDir.curVersionWoSuffix}"
/>
</target>
<target name="site-deploy">
<antcall target="svn-shorten-dir-name" />
<delete file="${site.deployDir}/svn-commit.tmp~" />
<exec executable="svn"
failonerror="true">
<arg value="add" />
<arg value="--force" />
<arg value="--depth=infinity" />
<arg value="${site.deployDir.curVersionWoSuffix}" />
</exec>
<taskdef name="foreach"
classname="net.sf.antcontrib.logic.ForEach"
/>
<foreach target="svn-mime=css"
param="src.css">
<path>
<fileset dir="${site.deployDir.curVersionWoSuffix}"
includes="**/*.css"
/>
</path>
</foreach>
<foreach target="svn-mime=html"
param="src.html">
<path>
<fileset dir="${site.deployDir.curVersionWoSuffix}"
includes="**/*.html"
/>
</path>
</foreach>
<antcall target="site-text-file-cleanup">
<param name="subDir"
value="${site.deployDir.curVersionWoSuffix}"
/>
</antcall>
<!--
Is allowed to fail in case of no files to delete:
[exec] svn: E205001: Try 'svn help delete' for more information
[exec] svn: E205001: Not enough arguments provided
-->
<exec executable="sh"
failonerror="false">
<arg value="-c" />
<arg value="svn st &quot;${site.deployDir.curVersionWoSuffix}&quot; | grep ! | cut -d! -f2 | sed 's/^ *//' | sed 's/^/\&quot;/g' | sed 's/$/\&quot;/g' | xargs svn rm" />
</exec>
<!-- Requires that SVN_EDITOR, VISUAL or EDITOR being set to edit commit description. -->
<exec executable="sh"
failonerror="true">
<arg value="-c" />
<arg value="svn ci &quot;${site.deployDir.curVersionWoSuffix}&quot; &lt; /dev/tty &gt; /dev/tty 2&gt; /dev/tty" />
</exec>
</target>
<target name="autogen"
depends="init"
if="is-unix">
<exec executable="sh">
<arg value="autogen.sh" />
</exec>
<!--
This was coupled with "site" originally, but made building "site" itself on Windows unneccessary
hard and the projects are not even used on the website, but only in releases instead. This target
is called in that case and some part of project files generation is unix centered already, too.
-->
<antcall target="gen-release-projects">
</antcall>
</target>
</project>