1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

During windows build use "icacls" tool to change file attributes

Previously the ant call "chmod" was used, but this is a no-op on Windows,
so it would works only if the IDE is cross-built from a unix host.

This patch allows to build a distribution of the IDE also from a Windows host.
This commit is contained in:
Cristian Maglie 2017-03-09 15:47:16 +02:00
parent 18f18bf2cb
commit 7dcc1352a2

View File

@ -24,6 +24,8 @@
<condition property="platform" value="linux64"><os family="unix" arch="amd64" /></condition> <condition property="platform" value="linux64"><os family="unix" arch="amd64" /></condition>
<condition property="platform" value="linuxarm"><os family="unix" arch="arm" /></condition> <condition property="platform" value="linuxarm"><os family="unix" arch="arm" /></condition>
<condition property="windows_host" value="true"><os family="windows" /></condition>
<condition property="macosx"><equals arg1="${platform}" arg2="macosx" /></condition> <condition property="macosx"><equals arg1="${platform}" arg2="macosx" /></condition>
<condition property="windows"><equals arg1="${platform}" arg2="windows" /></condition> <condition property="windows"><equals arg1="${platform}" arg2="windows" /></condition>
<condition property="linux32"><equals arg1="${platform}" arg2="linux32" /></condition> <condition property="linux32"><equals arg1="${platform}" arg2="linux32" /></condition>
@ -857,6 +859,19 @@
<unzip src="${archive_file}" dest="${dest_folder}"/> <unzip src="${archive_file}" dest="${dest_folder}"/>
</target> </target>
<!-- Ensure that the executable flag is set in all enviroments/OS -->
<target name="make-file-executable" depends="make-file-executable-windows">
<chmod perm="755" file="${file}" />
</target>
<target name="make-file-executable-windows" if="windows_host">
<exec executable="icacls" failonerror="false">
<arg value="${file}"/>
<arg value="/grant"/>
<arg value="Everyone:(RX)"/>
</exec>
</target>
<target name="linux-dist" depends="build" <target name="linux-dist" depends="build"
description="Build .tar.xz of linux version"> description="Build .tar.xz of linux version">
@ -983,7 +998,9 @@
<param name="dest_folder" value="${staging_folder}" /> <param name="dest_folder" value="${staging_folder}" />
</antcall> </antcall>
<copy file="windows/liblistSerials-${LIBLISTSERIAL-VERSION}/windows/listSerialsj.dll" todir="windows/work/lib/" /> <copy file="windows/liblistSerials-${LIBLISTSERIAL-VERSION}/windows/listSerialsj.dll" todir="windows/work/lib/" />
<chmod perm="755" file="windows/work/lib/listSerialsj.dll" /> <antcall target="make-file-executable">
<param name="file" value="windows/work/lib/listSerialsj.dll" />
</antcall>
<delete dir="${staging_folder}/arduino-builder-windows" includeemptydirs="true"/> <delete dir="${staging_folder}/arduino-builder-windows" includeemptydirs="true"/>
<mkdir dir="${staging_folder}/arduino-builder-windows"/> <mkdir dir="${staging_folder}/arduino-builder-windows"/>
@ -994,9 +1011,13 @@
<param name="dest_folder" value="${staging_folder}/arduino-builder-windows" /> <param name="dest_folder" value="${staging_folder}/arduino-builder-windows" />
</antcall> </antcall>
<copy file="${staging_folder}/arduino-builder-windows/arduino-builder.exe" tofile="windows/work/arduino-builder.exe" /> <copy file="${staging_folder}/arduino-builder-windows/arduino-builder.exe" tofile="windows/work/arduino-builder.exe" />
<chmod perm="755" file="windows/work/arduino-builder.exe" /> <antcall target="make-file-executable">
<param name="file" value="windows/work/arduino-builder.exe" />
</antcall>
<move file="${staging_folder}/arduino-builder-windows/tools" tofile="windows/work/tools-builder"/> <move file="${staging_folder}/arduino-builder-windows/tools" tofile="windows/work/tools-builder"/>
<chmod perm="755" file="windows/work/tools-builder/ctags/5.8-arduino11/ctags.exe" /> <antcall target="make-file-executable">
<param name="file" value="windows/work/tools-builder/ctags/5.8-arduino11/ctags.exe" />
</antcall>
<copy todir="windows/work/hardware" overwrite="true"> <copy todir="windows/work/hardware" overwrite="true">
<fileset dir="${staging_folder}/arduino-builder-windows/hardware" includes="*.txt"/> <fileset dir="${staging_folder}/arduino-builder-windows/hardware" includes="*.txt"/>
</copy> </copy>
@ -1012,7 +1033,9 @@
<arg value="com/sun/jna/win32-x86/jnidispatch.dll" /> <arg value="com/sun/jna/win32-x86/jnidispatch.dll" />
</exec> </exec>
<move file="windows/work/lib/jnidispatch.dll" tofile="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" /> <move file="windows/work/lib/jnidispatch.dll" tofile="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
<chmod perm="755" file="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" /> <antcall target="make-file-executable">
<param name="file" value="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
</antcall>
<antcall target="assemble"> <antcall target="assemble">
<param name="target.path" value="windows/work" /> <param name="target.path" value="windows/work" />