forked from tada/pljava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
106 lines (99 loc) · 3.47 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?xml version="1.0"?>
<project name="project" default="pg_config">
<property environment="env" />
<condition property="msvc-present">
<and>
<os family="windows"/>
<or>
<available file="cl.exe" filepath="${env.Path}" />
<available file="cl.exe" filepath="${env.PATH}" />
</or>
</and>
</condition>
<target name="configure_msvc" if="msvc-present">
<exec executable="cl" outputproperty="MSVC_HEADER"
osfamily="windows" logError="false"
failifexecutionfails="false"
/>
<loadresource property="MSVC_VER">
<string value="${MSVC_HEADER}" />
<filterchain>
<tokenfilter>
<containsregex pattern="[^\d]*(\d+)\.(\d+).*$" replace="\1\2" />
</tokenfilter>
<striplinebreaks/>
</filterchain>
</loadresource>
<property name="MSVC_VER" value="0000"/>
</target>
<target name="configure_nomsvc" unless="msvc-present">
<property name="MSVC_VER" value=""/>
<property name="MSVC_RINT" value="msvc.rint"/>
</target>
<target name="configure_msvc_options" depends="configure_msvc, configure_nomsvc"/>
<target name="pg_config" depends="configure_msvc_options">
<!-- First gather all values from the pg_config executable. -->
<exec executable="${pgsql.pgconfig}" outputproperty="PGSQL_BINDIR">
<arg line="--bindir"/>
</exec>
<exec executable="${pgsql.pgconfig}" outputproperty="PGSQL_PKGLIBDIR">
<arg line="--pkglibdir"/>
</exec>
<exec executable="${pgsql.pgconfig}" outputproperty="PGSQL_LIBDIR">
<arg line="--libdir"/>
</exec>
<exec executable="${pgsql.pgconfig}" outputproperty="PGSQL_INCLUDEDIR">
<arg line="--includedir"/>
</exec>
<exec executable="${pgsql.pgconfig}"
outputproperty="PGSQL_INCLUDEDIR-SERVER">
<arg line="--includedir-server"/>
</exec>
<exec executable="${pgsql.pgconfig}" outputproperty="PGSQL_VER">
<arg line="--version"/>
</exec>
<loadresource property="PGSQL_VER_CLASSIFIER">
<string value="${PGSQL_VER}" />
<filterchain>
<tokenfilter>
<replaceregex pattern="devel.*|alpha.*|beta.*|rc.*$"
replace="\.99" flags="si" />
<containsregex
pattern="^[^\d]*+(\d++)\.(\d++)(?:\.(\d++))?.*$"
replace="pg\1.\2" />
</tokenfilter>
</filterchain>
</loadresource>
<loadresource property="KNOWS_MSVC_RINT">
<filelist files="pg_config.h" dir="${PGSQL_INCLUDEDIR}"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<containsregex
pattern="#if \(_MSC_VER >= 1800\)\s+#define HAVE_RINT"/>
</tokenfilter>
</filterchain>
</loadresource>
<script
language="javascript"
classpathref="maven.plugin.classpath"><![CDATA[
var msvc_version = parseInt(project.getProperty('MSVC_VER'));
var knows_rint = project.getProperty('KNOWS_MSVC_RINT');
if (msvc_version >= 1800 && knows_rint === null) {
project.setProperty('MSVC_RINT', 'HAVE_RINT=1' );
} else {
project.setProperty('MSVC_RINT', 'msvc.rint' );
}
]]></script>
<!-- Finally write all properties to a file which Maven understands. -->
<propertyfile file="target/pgsql.properties" jdkproperties="true">
<entry key="PGSQL_VER_CLASSIFIER" value="${PGSQL_VER_CLASSIFIER}" />
<entry key="PGSQL_BINDIR" value="${PGSQL_BINDIR}" />
<entry key="PGSQL_PKGLIBDIR" value="${PGSQL_PKGLIBDIR}" />
<entry key="PGSQL_LIBDIR" value="${PGSQL_LIBDIR}" />
<entry key="PGSQL_INCLUDEDIR" value="${PGSQL_INCLUDEDIR}" />
<entry key="PGSQL_INCLUDEDIR-SERVER" value="${PGSQL_INCLUDEDIR-SERVER}" />
<entry key="MSVC_RINT" value="${MSVC_RINT}" />
</propertyfile>
</target>
</project>