PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/apache-log4j-1.2.17/src/ntdll/build.xml

#
XML | 180 lines | 128 code | 20 blank | 32 comment | 0 complexity | 9062b4ef8499a1f597b65702b3fd11ec MD5 | raw file
Possible License(s): Apache-2.0
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (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.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <!--
  16. Usage notes:
  17. To build NTEventLogAppender.dll using MinGW, place mingw\bin on path for Windows or install mingw
  18. package on other platforms. Build will execute gcc and windres on Windows and
  19. i586-mingw32msvc-gcc and i586-mingw32msvc-windres on other platforms.
  20. To build NTEventLogAppender.dll using Microsoft tools, run the appropriate vcvars for the
  21. target platform and specify msbuild as the target on the ant command line.
  22. -->
  23. <project name="ntdll" default="build" basedir=".">
  24. <property name="target.dir" value="target"/>
  25. <property name="object.dir" value="target/obj"/>
  26. <property name="src.dir" location="${basedir}"/>
  27. <property name="failonerror" value="false"/>
  28. <property name="failifexecutionfails" value="${failonerror}"/>
  29. <property name="jni.include.dir" location="${java.home}/../include"/>
  30. <property environment="env"/>
  31. <condition property="jni.win32.include.dir" value="${jni.include.dir}/win32">
  32. <available file="${jni.include.dir}/win32"/>
  33. </condition>
  34. <property name="jni.win32.include.dir" value="${env.JNI_WIN32_INCLUDE_DIR}"/>
  35. <available property="jni_md.h_available" file="${jni.win32.include.dir}/jni_md.h"/>
  36. <target name="clean" description="Deletes generated files">
  37. <delete dir="${target.dir}"/>
  38. </target>
  39. <!--
  40. Regenerates resource files from EventLogCategories.mc. Avoids
  41. need for Microsoft Platform SDK unless you are modifying EventLogCategories.mc
  42. -->
  43. <target name="mc" description="Update EventLogCategories.rc from .mc">
  44. <exec executable="mc">
  45. <arg value="-h"/>
  46. <arg file="${basedir}"/>
  47. <arg value="-r"/>
  48. <arg file="${basedir}"/>
  49. <arg file="EventLogCategories.mc"/>
  50. </exec>
  51. </target>
  52. <target name="windres">
  53. <condition property="mingw-prefix" value="">
  54. <os family="windows"/>
  55. </condition>
  56. <property name="mingw-prefix" value="i586-mingw32msvc-"/>
  57. <mkdir dir="${object.dir}"/>
  58. <exec executable="${mingw-prefix}windres"
  59. dir="${src.dir}"
  60. resultproperty="windres_status"
  61. failonerror="${failonerror}"
  62. failifexecutionfails="${failifexecutionfails}">
  63. <arg value="-o"/>
  64. <arg file="${object.dir}/NTEventLogAppender.o"/>
  65. <arg file="${src.dir}/NTEventLogAppender.rc"/>
  66. </exec>
  67. <condition property="windres_success">
  68. <equals arg1="${windres_status}" arg2="0"/>
  69. </condition>
  70. <condition property="do_compile">
  71. <and>
  72. <isset property="windres_success"/>
  73. <isset property="jni_md.h_available"/>
  74. </and>
  75. </condition>
  76. </target>
  77. <target name="compile" depends="windres" if="do_compile">
  78. <fail unless="classes.dir">-Dclasses.dir=/path/to/log4j/classes must be specified</fail>
  79. <javah class="org.apache.log4j.nt.NTEventLogAppender,org.apache.log4j.Priority"
  80. destdir="${object.dir}"
  81. classpath="${classes.dir}"/>
  82. <exec executable="${mingw-prefix}gcc">
  83. <arg value="-Wall"/>
  84. <arg value="-D_JNI_IMPLEMENTATION_"/>
  85. <arg value="-Wl,--kill-at"/>
  86. <arg value="-fno-rtti"/>
  87. <arg value="-fno-exceptions"/>
  88. <arg value="-s"/>
  89. <arg value="-I${jni.win32.include.dir}"/>
  90. <arg value="-I${jni.include.dir}"/>
  91. <arg value="-I${object.dir}"/>
  92. <arg value="-shared"/>
  93. <arg file="${src.dir}/nteventlog.cpp"/>
  94. <arg file="${object.dir}/NTEventLogAppender.o"/>
  95. <arg value="-o"/>
  96. <arg file="${target.dir}/NTEventLogAppender.dll"/>
  97. </exec>
  98. </target>
  99. <target name="windres-echo" depends="windres" unless="windres_success">
  100. <echo>${mingw-prefix}windres could not be found or failed, NTEventLogAppender.dll build skipped.</echo>
  101. </target>
  102. <target name="jni_md.h-echo" unless="jni_md.h_available">
  103. <echo>${jni.win32.include.dir}/jni_md.h not found, NTEventLogAppender.dll build skipped.</echo>
  104. </target>
  105. <target name="build" depends="compile, windres-echo, jni_md.h-echo" description="Build with MinGW gcc">
  106. </target>
  107. <target name="rc">
  108. <exec executable="rc"
  109. dir="${src.dir}"
  110. resultproperty="rc_status"
  111. failonerror="${failonerror}"
  112. failifexecutionfails="${failifexecutionfails}">
  113. <arg file="${src.dir}/NTEventLogAppender.rc"/>
  114. </exec>
  115. <condition property="rc_success">
  116. <equals arg1="${rc_status}" arg2="0"/>
  117. </condition>
  118. <condition property="do_cl">
  119. <and>
  120. <isset property="rc_success"/>
  121. <isset property="jni_md.h_available"/>
  122. </and>
  123. </condition>
  124. </target>
  125. <target name="cl" depends="rc" if="do_cl">
  126. <fail unless="classes.dir">-Dclasses.dir=/path/to/log4j/classes must be specified</fail>
  127. <mkdir dir="${object.dir}"/>
  128. <javah class="org.apache.log4j.nt.NTEventLogAppender,org.apache.log4j.Priority"
  129. destdir="${object.dir}"
  130. classpath="${classes.dir}"/>
  131. <property name="object.location" location="${object.dir}"/>
  132. <exec executable="cl" dir="${target.dir}">
  133. <arg value="/MT"/>
  134. <arg value="/D_JNI_IMPLEMENTATION_"/>
  135. <arg value="/O2"/>
  136. <arg value="/GR-"/>
  137. <arg value="/LD"/>
  138. <arg value="/I${jni.win32.include.dir}"/>
  139. <arg value="/I${jni.include.dir}"/>
  140. <arg value="/I${object.location}"/>
  141. <arg value="/I${src.dir}"/>
  142. <arg file="${src.dir}/nteventlog.cpp"/>
  143. <arg file="${src.dir}/NTEventLogAppender.res"/>
  144. <arg file="${src.dir}/NTEventLogAppender.def"/>
  145. <arg value="advapi32.lib"/>
  146. <arg value="/FeNTEventLogAppender.dll"/>
  147. </exec>
  148. </target>
  149. <target name="rc-echo" depends="rc" unless="rc_success">
  150. <echo>rc could not be found or failed, NTEventLogAppender.dll build skipped.</echo>
  151. </target>
  152. <target name="msbuild" depends="cl, rc-echo, jni_md.h-echo" description="Build using Microsoft tools">
  153. </target>
  154. </project>