This repository was archived by the owner on Sep 10, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
207 lines (186 loc) · 8.46 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?xml version="1.0" encoding="UTF-8"?>
<project name="module-php" basedir=".">
<dirname property="project.basedir" file="${ant.file.module-php}"/>
<property name="root.dir" location="${project.basedir}/.."/>
<property name="build.properties" value="${project.basedir}/build.properties"/>
<property file="${build.properties}"/>
<!-- Neard dev -->
<property name="dev.path" location="${root.dir}/dev"/>
<fail unless="dev.path" message="Project 'dev' not found in ${dev.path}"/>
<echo message="Neard dev found in ${dev.path}" level="debug"/>
<!-- Import build-commons.xml -->
<import file="${dev.path}/build/build-commons.xml"/>
<!-- Import build-bundle.xml -->
<import file="${dev.path}/build/build-bundle.xml"/>
<property name="php-ext.path" location="${project.basedir}/ext"/>
<property name="pear-install.path" location="${project.basedir}/pear"/>
<target name="release.build">
<basename property="bundle.folder" file="${bundle.path}"/>
<replaceproperty src="bundle.folder" dest="bundle.version" replace="${bundle.name}" with=""/>
<getmoduleuntouched name="${bundle.name}" version="${bundle.version}" propSrcDest="bundle.srcdest" propSrcFilename="bundle.srcfilename"/>
<assertfile file="${bundle.srcdest}/php.exe"/>
<property name="php.prep.path" location="${bundle.tmp.prep.path}/${bundle.name}${bundle.version}"/>
<delete dir="${php.prep.path}"/>
<mkdir dir="${php.prep.path}"/>
<copy todir="${php.prep.path}" overwrite="true">
<fileset dir="${bundle.srcdest}" excludes="
dev/**,
extras/**,
PEAR/**,
*.reg,
install.txt,
go-pear.bat,
news.txt,
php.gif,
php.ini*,
snapshot.txt"
/>
</copy>
<copy todir="${php.prep.path}" overwrite="true">
<fileset dir="${bundle.path}" defaultexcludes="yes"/>
</copy>
<!-- Install PEAR -->
<if>
<available file="${php.prep.path}/pear.properties" type="file"/>
<then>
<property prefix="phppear" file="${php.prep.path}/pear.properties"/>
<!-- Copy pear-install scripts -->
<echo message="Copying pear-install scripts..."/>
<delete dir="${php.prep.path}/pear-install"/>
<copy todir="${php.prep.path}/pear-install">
<fileset dir="${pear-install.path}" defaultexcludes="yes"/>
</copy>
<assertfile file="${php.prep.path}/pear-install/pear-install.bat"/>
<!-- Download phar -->
<download url="${phppear.pear}" returnProperty="phppear.dest"/>
<copy file="${phppear.dest}"
tofile="${php.prep.path}/pear-install/install-pear-nozlib.phar" overwrite="true"/>
<!-- Launch phar -->
<echo message="Processing phar..."/>
<exec executable="${php.prep.path}/pear-install/pear-install.bat"
dir="${php.prep.path}/pear-install"
failonerror="true"
/>
<delete dir="${php.prep.path}/pear-install"/>
<delete file="${php.prep.path}/pear.properties"/>
</then>
</if>
<!-- Extensions -->
<if>
<available file="${php.prep.path}/exts.properties" type="file"/>
<then>
<echo message="Processing extensions..."/>
<delete file="${build.tmp.path}/php_extensions.tmp"/>
<touch file="${build.tmp.path}/php_extensions.tmp"/>
<property prefix="phpexts" file="${php.prep.path}/exts.properties"/>
<propertyselector property="phpexts" match="phpexts\.(.*)" select="\1"/>
<for list="${phpexts}" param="phpext">
<sequential>
<var name="phpext.version" unset="true"/>
<var name="phpext.dest" unset="true"/>
<var name="phpext.dll" unset="true"/>
<propertyregex property="phpext.version" input="${phpexts.@{phpext}}" regexp="php_.*-(.*?(-dev))" select="\1"/>
<propertyregex property="phpext.version" input="${phpexts.@{phpext}}" regexp="php_.*-(.*)-(5\.|7\.)" select="\1"/>
<!-- Download ext -->
<download url="${phpexts.@{phpext}}" returnProperty="phpext.dest"/>
<echo message="Extension path: ${phpext.dest}"/>
<condition property="phpext.dll" value="${phpext.dest}/php_@{phpext}.dll"><available file="${phpext.dest}/php_@{phpext}.dll" type="file"/></condition>
<condition property="phpext.dll" value="${phpext.dest}"><matches string="${phpext.dest}" pattern="\.dll$"/></condition>
<fail unless="phpext.dll" message="Main dll not found"/>
<!-- Copy ext -->
<echo message="Copy @{phpext} ${phpext.version} extension..."/>
<copy file="${phpext.dll}" tofile="${php.prep.path}/ext/php_@{phpext}.dll" overwrite="true"/>
<if>
<equals arg1="@{phpext}" arg2="imagick"/>
<then>
<copy todir="${php.prep.path}/imagick">
<fileset dir="${phpext.dest}" includes="CORE_*.dll"/>
</copy>
</then>
</if>
<if>
<and>
<equals arg1="@{phpext}" arg2="ssh2"/>
<not><available file="${php.prep.path}/libssh2.dll" type="file"/></not>
<available file="${phpext.dest}/libssh2.dll" type="file"/>
</and>
<then>
<copy file="${phpext.dest}/libssh2.dll" todir="${php.prep.path}"/>
</then>
</if>
<!-- Echo extension string to temp file -->
<if>
<not><equals arg1="@{phpext}" arg2="xdebug"/></not>
<then>
<echo message="extension=php_@{phpext}.dll${line.separator}" file="${build.tmp.path}/php_extensions.tmp" append="true"/>
</then>
</if>
</sequential>
</for>
<!-- Inject in php.ini -->
<if>
<length file="${build.tmp.path}/php_extensions.tmp" when="equal" length="0" />
<then>
<property name="php.extensions" value=""/>
</then>
<else>
<loadfile property="php.extensions" srcFile="${build.tmp.path}/php_extensions.tmp"/>
</else>
</if>
<echo message="${line.separator}PHP extensions to inject in php.ini :${line.separator}${php.extensions}"/>
<copy todir="${php.prep.path}" overwrite="true">
<filterset>
<filter token="PHP_EXTENSIONS" value="${php.extensions}"/>
</filterset>
<resources>
<file file="${bundle.path}/php.ini"/>
<file file="${bundle.path}/php.ini.nrd"/>
</resources>
</copy>
<delete file="${php.prep.path}/exts.properties"/>
</then>
<else>
<copy todir="${php.prep.path}" overwrite="true">
<filterset>
<filter token="PHP_EXTENSIONS" value=""/>
</filterset>
<resources>
<file file="${bundle.path}/php.ini"/>
<file file="${bundle.path}/php.ini.nrd"/>
</resources>
</copy>
</else>
</if>
<!-- Dependencies -->
<if>
<available file="${php.prep.path}/deps.properties" type="file"/>
<then>
<echo message="Processing dependencies..."/>
<property prefix="phpdeps" file="${php.prep.path}/deps.properties"/>
<propertyselector property="phpdeps" match="phpdeps\.(.*)" select="\1"/>
<for list="${phpdeps}" param="phpdep">
<sequential>
<var name="phpdep.dest" unset="true"/>
<!-- Download dep -->
<download url="${phpdeps.@{phpdep}}" returnProperty="phpdep.dest"/>
<echo message="Dependency path: ${phpdep.dest}"/>
<!-- Copy dep -->
<echo message="Copy @{phpdep} dependency..."/>
<if>
<equals arg1="@{phpdep}" arg2="imagemagick"/>
<then>
<copy todir="${php.prep.path}/imagick" overwrite="true">
<fileset dir="${phpdep.dest}/bin" includes="
*.exe,
*.dll"
/>
</copy>
</then>
</if>
</sequential>
</for>
<delete file="${php.prep.path}/deps.properties"/>
</then>
</if>
</target>
</project>