1 <?xml version="1.0" encoding="UTF-8"?>
4 * $Date: 2010-08-25 13:25:44 +0200 (Mi, 25 Aug 2010) $
6 * Copyright (c) 2005-2012 David Kocher. All rights reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.package
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * Bug fixes, suggestions and comments should be sent to:
20 * dkocher@cyberduck.io
22 <project name="Cyberduck for Mac" basedir=".">
24 <import file="build.xml"/>
26 <property name="app.bundle" value="${build}/${app.name}.app"/>
27 <property name="cli.bundle" value="${build}/duck.bundle"/>
29 <property name="bundle.contents" value="Contents"/>
30 <property name="bundle.home" value="${bundle.contents}/Home"/>
31 <property name="bundle.macos" value="${bundle.contents}/MacOS"/>
32 <property name="bundle.library" value="${bundle.contents}/Library"/>
33 <property name="bundle.login" value="${bundle.library}/LoginItems"/>
34 <property name="bundle.frameworks" value="${bundle.contents}/Frameworks"/>
35 <property name="bundle.resources" value="${bundle.contents}/Resources"/>
36 <property name="bundle.spotlight" value="${bundle.library}/Spotlight"/>
37 <property name="bundle.profiles" value="${bundle.resources}/Profiles"/>
38 <property name="bundle.bookmarks" value="${bundle.resources}/Bookmarks"/>
39 <property name="bundle.runtime" value="${bundle.macos}/Runtime.jre"/>
40 <property name="bundle.runtime.lib"
41 value="@executable_path/../MacOS/Runtime.jre/Contents/Home/lib/server/libjvm.dylib"/>
43 <property name="app.runtime.system.min" value="10.7"/>
45 <property name="jvm.runtime.home" value="${lib}/1.8.0-u60-b10.jre"/>
46 <property name="jvm.runtime.bin" value="${jvm.runtime.home}/${bundle.home}/bin"/>
47 <property name="jvm.runtime.bin" value="${java.home}/bin"/>
49 <property name="codesign.certificate" value="Developer ID Application: David Kocher"/>
50 <property name="codesign.keychain" value="${user.home}/Library/Keychains/codesign.keychain"/>
51 <property name="app.codesign.entitlements" value="${setup}/app/sandbox.entitlements"/>
52 <!-- Designated requirement -->
53 <property name="codesign.requirement.source" value="${setup}/app/codesign-requirement.txt"/>
54 <property name="codesign.requirement" value="${setup}/app/codesign-requirement.bin"/>
55 <property name="codesign.options" value="--force"/>
56 <property name="codesign.arg"
57 value="--entitlements ${app.codesign.entitlements} --requirements ${codesign.requirement}"/>
59 <property name="keychain.password" value=""/>
61 <property name="installer.certificate" value="3rd Party Mac Developer Installer: David Kocher (G69SCX94XU)"/>
62 <property name="installer.keychain" value="${user.home}/Library/Keychains/codesign.keychain"/>
64 <property name="sparkle.feed" value="/dev/null"/>
66 <property name="spotlight" value="${home}/Spotlight Importer"/>
67 <property name="build.spotlight" value="${spotlight}/build/${configuration}"/>
69 <property name="build.xcodeoptions" value="SDKROOT=macosx MACOSX_DEPLOYMENT_TARGET=${app.runtime.system.min}"/>
71 <property name="build.lipo.binaries" value="**/Contents/MacOS/*,**/*.framework/Versions/Current/*,**/*.dylib"/>
72 <property name="build.lipo.arch.remove" value=""/>
74 <target name="spotlight">
75 <local name="build.settings"/>
76 <property name="build.settings"
77 value="${build.xcodeoptions} VERSION=${version} REVISION=${revision} COPYRIGHT='${copyright}'"/>
78 <echo message="Build settings ${build.settings}"/>
79 <exec dir="${spotlight}" executable="/usr/bin/xcrun" spawn="false" failonerror="true">
80 <arg line="--verbose xcodebuild -project 'Spotlight Importer.xcodeproj' -configuration Release ${build.settings}"/>
82 <copy todir="${app.bundle}/${bundle.spotlight}">
83 <fileset dir="${build.spotlight}">
84 <include name="*.mdimporter/**"/>
87 <chmod perm="a+x" type="file">
88 <fileset dir="${app.bundle}/${bundle.spotlight}">
89 <include name="**/MacOS/*"/>
94 <target name="_dependencies">
95 <mkdir dir="${bundle}/${bundle.frameworks}"/>
96 <copy todir="${bundle}/${bundle.frameworks}">
97 <!-- Dynamic libraries built with xcodebuild -->
98 <fileset dir="${build}">
99 <include name="*.dylib"/>
101 <fileset dir="${lib}">
102 <!-- Include libjnidispatch.dylib -->
103 <include name="*.dylib"/>
106 <mkdir dir="${bundle}/${bundle.resources}"/>
107 <copy todir="${bundle}/${bundle.resources}">
108 <fileset dir="${build}">
109 <include name="*.jar"/>
111 <fileset dir="${lib}">
112 <include name="*.jar"/>
115 <mkdir dir="${bundle}/${bundle.runtime}/${bundle.home}"/>
116 <!-- Copy runtime -->
117 <echo message="Copy runtime from ${jvm.runtime.home} to ${bundle}/${bundle.runtime}..."/>
118 <copy todir="${bundle}/${bundle.runtime}" preservelastmodified="true">
119 <fileset followsymlinks="false" dir="${jvm.runtime.home}" excludesfile="runtime-excludes.properties"/>
121 <antcall target="shared-library-install-name">
122 <param name="oldname" value="/System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM"/>
123 <param name="newname" value="${bundle.runtime.lib}"/>
124 <param name="directory" value="${bundle}/${bundle.frameworks}"/>
126 <!-- Remove architectures -->
127 <foreach target="lipo" param="arch" list="${build.lipo.arch.remove}">
128 <param name="directory" value="${bundle}"/>
132 <target name="_build" depends="spotlight">
133 <echo message="Building ${app.bundle}"/>
134 <local name="build.settings"/>
135 <property name="build.settings"
136 value="${build.xcodeoptions} VERSION=${version} REVISION=${revision} SPARKLEFEED='https://version.cyberduck.io/${app.update.feed}/changelog.rss' COPYRIGHT='${copyright}'"/>
137 <echo message="Build settings ${build.settings} for feed ${app.update.feed}"/>
138 <exec dir="${home}" executable="/usr/bin/xcrun" spawn="false" failonerror="true">
139 <arg line="--verbose xcodebuild -project '${app.name}.xcodeproj' -configuration Release -target app ${build.settings}"/>
141 <antcall target="_dependencies">
142 <param name="bundle" value="${app.bundle}"/>
147 <echo message="Building ${cli.bundle}"/>
148 <property name="build.settings"
149 value="MACOSX_DEPLOYMENT_TARGET=${app.runtime.system.min} VERSION=${version} REVISION=${revision} COPYRIGHT='${copyright}'"/>
150 <exec dir="${home}" executable="/usr/bin/xcrun" spawn="false" failonerror="true">
151 <arg line="--verbose xcodebuild -project '${app.name}.xcodeproj' -configuration Release -target cli ${build.settings}"/>
153 <copy todir="${cli.bundle}/${bundle.frameworks}">
154 <!-- Dynamic libraries built with xcodebuild -->
155 <fileset dir="${build}">
156 <include name="*.dylib"/>
158 <fileset followsymlinks="false" dir="${lib}">
159 <!-- Include libjnidispatch.dylib -->
160 <include name="*.dylib"/>
163 <copy todir="${cli.bundle}/${bundle.resources}">
164 <fileset dir="${build}">
165 <include name="config-${version}.jar"/>
166 <include name="core-${version}.jar"/>
167 <include name="fs-${version}.jar"/>
168 <include name="binding-${version}.jar"/>
169 <include name="cli-${version}.jar"/>
171 <fileset dir="${lib}">
172 <include name="*.jar"/>
175 <mkdir dir="${app.bundle}/${bundle.runtime}/${bundle.home}"/>
176 <!-- Copy runtime -->
177 <echo message="Copy runtime from ${jvm.runtime.home} to ${cli.bundle}/${bundle.runtime}..."/>
178 <copy todir="${cli.bundle}/${bundle.runtime}" preservelastmodified="true">
179 <fileset followsymlinks="false" dir="${jvm.runtime.home}" excludesfile="runtime-excludes.properties"/>
181 <symlink link="${cli.bundle}/${bundle.runtime}/Contents/MacOS/libjli.dylib"
182 resource="../Home/lib/jli/libjli.dylib"
184 <antcall target="shared-library-install-name">
185 <param name="oldname" value="/System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM"/>
186 <param name="newname" value="${bundle.runtime.lib}"/>
187 <param name="directory" value="${cli.bundle}/${bundle.frameworks}"/>
189 <!-- Remove architectures -->
190 <foreach target="lipo" param="arch" list="${build.lipo.arch.remove}">
191 <param name="directory" value="${cli.bundle}"/>
195 <target name="tarball" depends="revision">
196 <antcall target="tar">
197 <param name="directory" value="${home}"/>
198 <param name="source" value="."/>
199 <param name="target" value="duck-src-${version}.${revision}.tar.gz"/>
201 <checksum file="${build.deploy}/duck-src-${version}.${revision}.tar.gz"
202 algorithm="sha-256" property="source.sha256"/>
205 <target name="package.cli" depends="tarball,cli">
206 <antcall target="codesign">
207 <param name="bundle" value="${cli.bundle}"/>
208 <param name="codesign.options" value="--force"/>
209 <!-- No sandboxing enabled -->
210 <param name="codesign.arg" value=""/>
211 <param name="codesign.certificate" value="Developer ID Application: David Kocher"/>
213 <antcall target="verify-spctl">
214 <param name="bundle" value="${cli.bundle}"/>
216 <antcall target="tar">
217 <param name="directory" value="${build}"/>
218 <param name="source" value="duck.bundle"/>
219 <param name="target" value="duck-${version}.${revision}.tar.gz"/>
221 <checksum file="${build.deploy}/duck-${version}.${revision}.tar.gz"
222 algorithm="sha1" property="archive.sha1"/>
223 <copy todir="${build.deploy}" overwrite="true">
224 <fileset dir="${setup}/brew">
225 <include name="*.rb"/>
228 <replace dir="${build.deploy}" summary="true" encoding="UTF-8">
229 <include name="*.rb"/>
230 <replacefilter token="${REVISION}" value="${revision}"/>
231 <replacefilter token="${VERSION}" value="${version}"/>
232 <replacefilter token="${ARCHIVE.SHA1}" value="${archive.sha1}"/>
233 <replacefilter token="${ARCHIVE}"
234 value="https://dist.duck.sh/duck-${version}.${revision}.tar.gz"/>
235 <replacefilter token="${SOURCE.SHA256}" value="${source.sha256}"/>
236 <replacefilter token="${SOURCE}"
237 value="https://dist.duck.sh/duck-src-${version}.${revision}.tar.gz"/>
239 <exec dir="${build.deploy}" executable="/usr/bin/pkgbuild" spawn="false" failonerror="true">
240 <arg line="--component ${cli.bundle} --install-location /usr/local --version ${version} --scripts ${setup}/pkg --sign '${installer.certificate}' --keychain ${codesign.keychain} ${build.deploy}/duck-${version}.${revision}.pkg"/>
242 <checksum file="${build.deploy}/duck-${version}.${revision}.pkg" algorithm="md5"/>
243 <exec executable="/usr/sbin/pkgutil" failonerror="true">
244 <arg line="--check-signature ${build.deploy}/duck-${version}.${revision}.pkg"/>
248 <target name="package" depends="build">
249 <antcall target="codesign">
250 <param name="bundle" value="${app.bundle}"/>
251 <!-- No sandboxing enabled -->
252 <param name="codesign.arg" value="--requirements ${codesign.requirement}"/>
253 <param name="codesign.certificate" value="Developer ID Application: David Kocher"/>
255 <antcall target="verify-spctl">
256 <param name="bundle" value="${app.bundle}"/>
258 <antcall target="tar">
259 <param name="directory" value="${build}"/>
260 <param name="target" value="${app.name}-${revision}.tar.gz"/>
261 <param name="source" value="${app.name}.app"/>
263 <antcall target="zip">
264 <param name="directory" value="${build}"/>
265 <param name="target" value="${app.name}-${version}.zip"/>
266 <param name="source" value="${app.name}.app"/>
268 <checksum file="${build.deploy}/${app.name}-${revision}.tar.gz"
269 algorithm="md5" property="md5sum"/>
270 <echo message="Calculating DSA signature..."/>
271 <exec dir="${home}" executable="sh" outputproperty="signature.dsa" failonerror="true">
273 <arg value="pipefail"/>
275 <arg value="openssl dgst -sha1 -binary '${build.deploy}/${app.name}-${revision}.tar.gz' | openssl dgst -dss1 -sign ${www.update}/private.pem | openssl enc -base64"/>
277 <echo message="DSASIGNATURE=${signature.dsa}"/>
278 <echo message="MD5SUM=${md5sum}"/>
279 <copy todir="${build.deploy}" overwrite="true">
280 <fileset dir="${www.update}">
281 <include name="changelog.rss"/>
282 <include name="changelog.html"/>
285 <replace dir="${build.deploy}" summary="true" encoding="UTF-8">
286 <include name="changelog.rss"/>
287 <replacefilter token="${TIMESTAMP}" value="${touch.time}"/>
288 <replacefilter token="${ARCHIVE}"
289 value="https://update.cyberduck.io/${app.update.feed}/${app.name}-${revision}.tar.gz"/>
290 <replacefilter token="${CHANGELOG}" value="https://version.cyberduck.io/${app.update.feed}/changelog.html"/>
291 <replacefilter token="${REVISION}" value="${revision}"/>
292 <replacefilter token="${VERSION}" value="${version}"/>
293 <replacefilter token="${DSASIGNATURE}" value="${signature.dsa}"/>
294 <replacefilter token="${COPYRIGHT}" value="${copyright}"/>
295 <replacefilter token="${MACOSX_DEPLOYMENT_TARGET}" value="${app.runtime.system.min}"/>
299 <target name="package.mas" depends="build">
300 <replace dir="${app.bundle}/${bundle.contents}" summary="true" encoding="UTF-8">
301 <include name="Info.plist"/>
302 <!-- Disable Sparkle Keys -->
303 <replacefilter token="SU" value="None"/>
305 <delete dir="${app.bundle}/${bundle.frameworks}/Sparkle.framework"/>
306 <antcall target="codesign">
307 <param name="bundle" value="${app.bundle}"/>
308 <param name="codesign.arg" value="--entitlements ${app.codesign.entitlements}"/>
309 <param name="codesign.certificate" value="3rd Party Mac Developer Application: David Kocher (G69SCX94XU)"/>
311 <echo message="Building ${build.deploy}/${app.name}-${version}.${revision}.pkg"/>
312 <exec dir="${build.deploy}" executable="/usr/bin/productbuild" spawn="false" failonerror="true">
313 <arg line="--component ${app.bundle} /Applications --version ${version} --sign '${installer.certificate}' --keychain ${installer.keychain} ${build.deploy}/${app.name}-${version}.${revision}.pkg"/>
315 <checksum file="${build.deploy}/${app.name}-${version}.${revision}.pkg" algorithm="md5"/>
319 <echo message="Remove ${arch} slice from ${build.lipo.binaries}"/>
320 <apply executable="/usr/bin/lipo" failonerror="false" dest="${directory}"
321 parallel="false" spawn="false" force="true">
322 <!--Remove from executables-->
323 <!--Remove from frameworks-->
324 <!--Remove from shared libraries-->
325 <fileset dir="${directory}" includes="${build.lipo.binaries}"/>
326 <arg line="-remove ${arch} -output"/>
333 <target name="shared-library-install-name">
334 <echo message="Change dynamic shared library install names to ${newname}"/>
335 <apply executable="/usr/bin/install_name_tool" failonerror="true"
337 parallel="false" spawn="false" force="true">
338 <arg line="-change ${oldname} ${newname}"/>
339 <fileset dir="${directory}">
340 <include name="*.dylib"/>
346 <target name="codesign" depends="unlock-keychain, compile-codesign-requirement">
347 <echo message="Code signing ${bundle} with certificate ${codesign.certificate} and entitlements ${codesign.arg}..."/>
348 <apply executable="/usr/bin/codesign" failonerror="true"
350 parallel="false" spawn="false" force="true">
351 <arg line="${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
352 <fileset dir="${bundle}/${bundle.spotlight}" erroronmissingdir="false">
353 <include name="*.mdimporter"/>
357 <apply executable="/usr/bin/codesign" failonerror="true"
359 parallel="false" spawn="false" force="true">
360 <arg line="${codesign.options} --identifier ch.sudo.cyberduck --sign '${codesign.certificate}' --keychain ${codesign.keychain} ${codesign.arg} -v"/>
361 <fileset dir="${bundle}/${bundle.frameworks}">
362 <include name="*.dylib"/>
363 <include name="*.jar"/>
367 <apply executable="/usr/bin/codesign" failonerror="true"
369 parallel="false" spawn="false" force="true">
370 <arg line="${codesign.options} --identifier net.java.openjdk.jre --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
371 <fileset dir="${bundle}/${bundle.runtime}" erroronmissingdir="false">
372 <include name="**/*.dylib"/>
373 <include name="**/*.jar"/>
375 <fileset dir="${bundle}/${bundle.macos}">
376 <include name="*.jre"/>
380 <apply executable="/usr/bin/codesign" failonerror="true"
382 parallel="false" spawn="false" force="true">
383 <arg line="${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} -v"/>
384 <fileset dir="${bundle}/${bundle.frameworks}">
385 <include name="*.framework/Versions/A"/>
389 <apply executable="/usr/bin/codesign" failonerror="true"
391 parallel="false" spawn="false" force="true">
392 <arg line="${codesign.options} --sign '${codesign.certificate}' --keychain ${codesign.keychain} ${codesign.arg} -v"/>
393 <file name="${bundle}"/>
396 <antcall target="verify-signature">
397 <param name="bundle" value="${bundle}"/>
401 <target name="unlock-keychain">
402 <exec executable="/usr/bin/security" failonerror="true">
403 <arg line="unlock-keychain -p ${keychain.password} ${codesign.keychain}"/>
407 <target name="compile-codesign-requirement">
408 <echo message="Compile codesign requirement ${codesign.requirement}..."/>
409 <exec executable="/usr/bin/csreq" failonerror="true">
410 <arg line="-r ${codesign.requirement.source} -b ${codesign.requirement}"/>
414 <target name="verify-signature">
415 <echo message="Print codesign requirement for ${bundle}..."/>
416 <exec executable="/usr/bin/codesign" failonerror="true">
417 <arg line="-d -r- --deep-verify '${bundle}'"/>
421 <target name="verify-spctl">
422 <echo message="Print system policy verification for ${bundle}..."/>
423 <exec executable="/usr/sbin/spctl" failonerror="true">
424 <arg line="-v --assess --type execute '${bundle}'"/>
429 <echo message="Creating tar.gz archive from ${directory}/${source}"/>
430 <exec dir="${directory}" executable="tar" spawn="false" failonerror="true">
431 <arg line="--exclude .svn --exclude build -czf ${build.deploy}/${target} ${source}"/>
433 <echo message="Calculating MD5 sum..."/>
434 <checksum file="${build.deploy}/${target}" algorithm="md5"/>
438 <echo message="Creating ZIP archive from ${directory}/${source}"/>
439 <exec dir="${directory}" executable="ditto" spawn="false" failonerror="true">
440 <arg line="-c -k --keepParent ${source} ${build.deploy}/${target}"/>
442 <checksum file="${build.deploy}/${target}" algorithm="md5"/>