Skip to content

Commit 898b98d

Browse files
committed
windows : move executables to ${user.home}
1 parent 86736db commit 898b98d

7 files changed

Lines changed: 47 additions & 51 deletions

File tree

base.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
</fileset>
8787
</zip>
8888
<delete dir="${maven-app-version}"/>
89-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.Publish" fork="true" jvm="${env.HOME}/bin/jfexec">
89+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.Publish" fork="true" jvm="${user.home}/bin/jfexec">
9090
<arg value="central-bundle.zip"/>
9191
<arg value="USER_MANAGED"/>
9292
</java>
@@ -146,7 +146,7 @@
146146

147147
<target name="executable" depends="jar,depjars,depnatives" description="create executable launcher">
148148
<sequential>
149-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenExecutable" fork="true" jvm="${env.HOME}/bin/jfexec">
149+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenExecutable" fork="true" jvm="${user.home}/bin/jfexec">
150150
<arg value="${ant.file}"/>
151151
</java>
152152
</sequential>
@@ -158,20 +158,20 @@
158158
</target>
159159

160160
<target name="graal" depends="jar,depjars,graalmeta" description="generate aot library">
161-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.ExecGraal" fork="true" jvm="${env.HOME}/bin/jfexec">
161+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.ExecGraal" fork="true" jvm="${user.home}/bin/jfexec">
162162
<arg value="${ant.file}"/>
163163
</java>
164164
</target>
165165

166166
<target name="graalagent">
167-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.ExecGraalAgent" fork="true" jvm="${env.HOME}/bin/jfexec">
167+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.ExecGraalAgent" fork="true" jvm="${user.home}/bin/jfexec">
168168
<arg value="${ant.file}"/>
169169
</java>
170170
</target>
171171

172172
<target name="run">
173173
<sequential>
174-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.ExecProject" fork="true" jvm="${env.HOME}/bin/jfexec">
174+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.ExecProject" fork="true" jvm="${user.home}/bin/jfexec">
175175
<arg value="${ant.file}"/>
176176
</java>
177177
</sequential>
@@ -180,7 +180,7 @@
180180
<!-- Windows targets -->
181181

182182
<target name="msi" depends="executable" description="create msi package">
183-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenMSI" fork="true" jvm="${env.HOME}/bin/jfexec">
183+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenMSI" fork="true" jvm="${user.home}/bin/jfexec">
184184
<arg value="${ant.file}"/>
185185
</java>
186186
</target>
@@ -195,7 +195,7 @@
195195

196196
<target name="installapproot">
197197
<!-- this will run "install" target in project as root including sub-projects -->
198-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.InstallProject" fork="true" jvm="${env.HOME}/bin/jfexec">
198+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.InstallProject" fork="true" jvm="${user.home}/bin/jfexec">
199199
<arg value="${ant.file}"/>
200200
</java>
201201
</target>
@@ -207,27 +207,27 @@
207207
</target>
208208

209209
<target name="uninstallapproot">
210-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.UninstallProject" fork="true" jvm="${env.HOME}/bin/jfexec">
210+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.UninstallProject" fork="true" jvm="${user.home}/bin/jfexec">
211211
<arg value="${ant.file}"/>
212212
</java>
213213
</target>
214214

215215
<target name="deb" depends="installapp" description="create deb package">
216-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenDEB" fork="true" jvm="${env.HOME}/bin/jfexec">
216+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenDEB" fork="true" jvm="${user.home}/bin/jfexec">
217217
<arg value="${ant.file}"/>
218218
<arg value="${debian.depends}"/>
219219
</java>
220220
</target>
221221

222222
<target name="rpm" depends="installapp" description="create rpm package">
223-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenRPM" fork="true" jvm="${env.HOME}/bin/jfexec">
223+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenRPM" fork="true" jvm="${user.home}/bin/jfexec">
224224
<arg value="${ant.file}"/>
225225
<arg value="${fedora.depends}"/>
226226
</java>
227227
</target>
228228

229229
<target name="pac" depends="installapp" description="create pac package">
230-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenPAC" fork="true" jvm="${env.HOME}/bin/jfexec">
230+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenPAC" fork="true" jvm="${user.home}/bin/jfexec">
231231
<arg value="${ant.file}"/>
232232
<arg value="${arch.depends}"/>
233233
</java>
@@ -236,7 +236,7 @@
236236
<!-- MacOSX targets -->
237237

238238
<target name="dmg" depends="executable" description="create dmg package">
239-
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenDMG" fork="true" jvm="${env.HOME}/bin/jfexec">
239+
<java classpath="${home}/javaforce.jar" classname="javaforce.utils.GenDMG" fork="true" jvm="${user.home}/bin/jfexec">
240240
<arg value="${ant.file}"/>
241241
</java>
242242
</target>

native/linux/build.xml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,31 @@
33

44
<property name="opt" value="-O3"/> <!-- change to -g to debug -->
55

6-
<property environment="env"/>
7-
86
<macrodef name="build" description="create linux natives">
97
<attribute name="libs"/>
108
<attribute name="linux"/>
119
<sequential>
12-
<mkdir dir="${env.HOME}/bin"/>
10+
<mkdir dir="${user.home}/bin"/>
1311
<!-- build native library -->
1412
<exec command="gcc ${opt} -I /usr/include/ffmpeg -I ${java.home}/include/@{linux} -I ${java.home}/include -I ../headers -I ../opencl -Wno-write-strings native.cpp -c -o native.o -fPIC"/>
1513
<exec command="gcc ${opt} -I ../glfw/include glfw.c -c -o glfw.o -fPIC -Wno-implicit-function-declaration"/>
1614
<exec command="gcc ${opt} -I ../glfw/include glfw-null.c -c -o glfw-null.o -fPIC"/>
1715
<exec command="ar r native.a native.o glfw.o glfw-null.o"/>
1816

1917
<!-- build native executables -->
20-
<exec command="gcc ${opt} -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings loader.cpp native.a @{libs} -o ${env.HOME}/bin/linux64.bin"/>
21-
<exec command="gcc ${opt} -D_JF_SERVICE -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings loader.cpp native.a @{libs} -o ${env.HOME}/bin/linux64s.bin"/>
18+
<exec command="gcc ${opt} -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings loader.cpp native.a @{libs} -o ${user.home}/bin/linux64.bin"/>
19+
<exec command="gcc ${opt} -D_JF_SERVICE -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings loader.cpp native.a @{libs} -o ${user.home}/bin/linux64s.bin"/>
2220
<!-- fedora adds a build-id that conflicts each time the executable in found in a package -->
23-
<exec command="strip -R .note.gnu.build-id ${env.HOME}/bin/linux64.bin"/>
24-
<exec command="strip -R .note.gnu.build-id ${env.HOME}/bin/linux64s.bin"/>
21+
<exec command="strip -R .note.gnu.build-id ${user.home}/bin/linux64.bin"/>
22+
<exec command="strip -R .note.gnu.build-id ${user.home}/bin/linux64s.bin"/>
2523

2624
<!-- build cli version -->
27-
<exec command="gcc ${opt} -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings -D_JF_CLI loader.cpp native.a @{libs} -o ${env.HOME}/bin/jfexec"/>
28-
<exec command="gcc ${opt} -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings -D_JF_CLI -D_JF_DEBUG loader.cpp native.a @{libs} -o ${env.HOME}/bin/jfexecd"/>
29-
<exec command="gcc ${opt} -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings -D_JF_CLI -D_JF_DEBUG -D_JF_SERVICE loader.cpp native.a @{libs} -o ${env.HOME}/bin/jfexecsd"/>
25+
<exec command="gcc ${opt} -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings -D_JF_CLI loader.cpp native.a @{libs} -o ${user.home}/bin/jfexec"/>
26+
<exec command="gcc ${opt} -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings -D_JF_CLI -D_JF_DEBUG loader.cpp native.a @{libs} -o ${user.home}/bin/jfexecd"/>
27+
<exec command="gcc ${opt} -I ${java.home}/include -I ${java.home}/include/@{linux} -I ../headers -I ../opencl -Wno-write-strings -D_JF_CLI -D_JF_DEBUG -D_JF_SERVICE loader.cpp native.a @{libs} -o ${user.home}/bin/jfexecsd"/>
3028

3129
<!-- build shared library (optional) -->
32-
<exec command="gcc ${opt} -shared native.o glfw.o glfw-null.o @{libs} -o ${env.HOME}/bin/jfnative64.so"/>
30+
<exec command="gcc ${opt} -shared native.o glfw.o glfw-null.o @{libs} -o ${user.home}/bin/jfnative64.so"/>
3331

3432
<delete>
3533
<fileset dir=".">

native/mac/build.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,22 @@
44

55
<property name="opt" value="-O3"/> <!-- change to -g to debug -->
66

7-
<property environment="env"/>
8-
97
<property name="libs" value="-ldl -lpthread"/>
108

119
<target name="mac" description="create mac native so">
12-
<mkdir dir="${env.HOME}/bin"/>
10+
<mkdir dir="${user.home}/bin"/>
1311
<!-- build native library -->
1412
<exec command="gcc ${opt} -I ${env.FFMPEG_HOME} -I ${java.home} -I ${java.home}/include -I ${java.home}/include/darwin -I ../headers native.mm -c -o native.o -fPIC"/>
1513
<exec command="gcc ${opt} -I ../glfw/include glfw.m -c -o glfw.o -fPIC"/>
1614
<exec command="gcc ${opt} -I ../glfw/include glfw-null.m -c -o glfw-null.o -fPIC"/>
1715
<exec command="ar r native.a native.o glfw.o glfw-null.o"/>
1816

1917
<!-- build native executable -->
20-
<exec command="gcc -framework CoreFoundation -I ${java.home}/include -I ${java.home}/include/darwin -I ../headers loader.mm ${libs} -o ${env.HOME}/bin/mac64.bin"/>
18+
<exec command="gcc -framework CoreFoundation -I ${java.home}/include -I ${java.home}/include/darwin -I ../headers loader.mm ${libs} -o ${user.home}/bin/mac64.bin"/>
2119

2220
<!-- build native cli executable -->
23-
<exec command="gcc -framework CoreFoundation -I ${java.home}/include -I ${java.home}/include/darwin -I ../headers -D_JF_CLI loader.mm ${libs} -o ${env.HOME}/bin/jfexec"/>
24-
<exec command="gcc -framework CoreFoundation -I ${java.home}/include -I ${java.home}/include/darwin -I ../headers -D_JF_CLI -D_JF_DEBUG loader.mm ${libs} -o ${env.HOME}/bin/jfexecd"/>
21+
<exec command="gcc -framework CoreFoundation -I ${java.home}/include -I ${java.home}/include/darwin -I ../headers -D_JF_CLI loader.mm ${libs} -o ${user.home}/bin/jfexec"/>
22+
<exec command="gcc -framework CoreFoundation -I ${java.home}/include -I ${java.home}/include/darwin -I ../headers -D_JF_CLI -D_JF_DEBUG loader.mm ${libs} -o ${user.home}/bin/jfexecd"/>
2523

2624
<delete>
2725
<fileset dir=".">

native/windows/build.xml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,32 @@
77

88
<target name="windows" description="create windows native files">
99
<echo>ffmpeg-src=${home}/ffmpeg-src/${ffmpeg-version}</echo>
10+
<mkdir dir="${user.home}/bin"/>
1011
<!-- native library -->
1112
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '${home}/ffmpeg-src/${ffmpeg-version}' /I '../headers' /I '../opencl' native.cpp /c /Fo: native.obj"/>
1213
<exec command="cl /I '../glfw/include' glfw.c /c /Fo: glfw.obj"/>
1314
<exec command="cl /I '../glfw/include' glfw-null.c /c /Fo: glfw-null.obj"/>
1415
<exec command="lib /nologo /out:native.lib ${objs}"/>
1516

1617
<!-- native loaders -->
17-
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' loader.cpp native.lib ${winlibs} /Fe: ../win64.exe /link /subsystem:windows /entry:mainCRTStartup"/>
18-
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' loader.cpp native.lib ${winlibs} /Fe: ../win64c.exe /link /subsystem:console"/>
19-
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_SERVICE loader.cpp native.lib ${winlibs} /Fe: ../win64s.exe /link /subsystem:console"/>
18+
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' loader.cpp native.lib ${winlibs} /Fe: ${user.home}/bin/win64.exe /link /subsystem:windows /entry:mainCRTStartup"/>
19+
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' loader.cpp native.lib ${winlibs} /Fe: ${user.home}/bin/win64c.exe /link /subsystem:console"/>
20+
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_SERVICE loader.cpp native.lib ${winlibs} /Fe: ${user.home}/bin/win64s.exe /link /subsystem:console"/>
2021

2122
<!-- native cli loaders -->
22-
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI loader.cpp native.lib ${winlibs} /Fe: ../../bin/jfexecw.exe /link /subsystem:windows /entry:mainCRTStartup"/>
23-
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI loader.cpp native.lib ${winlibs} /Fe: ../../bin/jfexec.exe /link /subsystem:console"/>
24-
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI /D_JF_DEBUG loader.cpp native.lib ${winlibs} /Fe: ../../bin/jfexecwd.exe /link /subsystem:windows /entry:mainCRTStartup"/>
25-
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI /D_JF_DEBUG loader.cpp native.lib ${winlibs} /Fe: ../../bin/jfexecd.exe /link /subsystem:console"/>
26-
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI /D_JF_DEBUG /D_JF_CLI_SERVICE loader.cpp native.lib ${winlibs} /Fe: ../../bin/jfexecsd.exe /link /subsystem:console"/>
23+
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI loader.cpp native.lib ${winlibs} /Fe: ${user.home}/bin/jfexecw.exe /link /subsystem:windows /entry:mainCRTStartup"/>
24+
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI loader.cpp native.lib ${winlibs} /Fe: ${user.home}/bin/jfexec.exe /link /subsystem:console"/>
25+
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI /D_JF_DEBUG loader.cpp native.lib ${winlibs} /Fe: ${user.home}/bin/jfexecwd.exe /link /subsystem:windows /entry:mainCRTStartup"/>
26+
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI /D_JF_DEBUG loader.cpp native.lib ${winlibs} /Fe: ${user.home}/bin/jfexecd.exe /link /subsystem:console"/>
27+
<exec command="cl /I '${java.home}/include' /I '${java.home}/include/win32' /I '../headers' /D_JF_CLI /D_JF_DEBUG /D_JF_CLI_SERVICE loader.cpp native.lib ${winlibs} /Fe: ${user.home}/bin/jfexecsd.exe /link /subsystem:console"/>
2728

2829
<!-- native shared library (optional) -->
2930
<exec command="cl /LD /MT ${objs} ${winlibs} libcmt.lib /Fe: ../jfnative64.dll /link /MACHINE:X64"/>
31+
32+
<delete>
33+
<fileset dir="." includes="*.obj"/>
34+
<fileset dir="." includes="*.lib"/>
35+
</delete>
3036
</target>
3137

3238
<target name="get-bin" description="download pre-built binaries">

src/javaforce/utils/ExecGraalAgent.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,17 @@ public void run(String buildfile) throws Exception {
6363
ShellProcess sp = new ShellProcess();
6464
sp.addListener(this);
6565
ArrayList<String> cmd = new ArrayList<String>();
66-
String home = tools.getProperty("home");
67-
String HOME = System.getenv("HOME");
66+
String user_home = System.getProperty("user.home");
6867
String exec = "jfexec";
6968
if (service != null) {
7069
exec += "s";
7170
}
7271
exec += "d"; //use debug version
7372
if (JF.isWindows()) {
7473
exec += ".exe";
75-
} else {
76-
home = HOME;
7774
}
7875

79-
cmd.add(home + "/bin/" + exec);
76+
cmd.add(user_home + "/bin/" + exec);
8077
cmd.add("-agentlib:native-image-agent=config-output-dir=META-INF/native-image");
8178
cmd.add("-cp");
8279
if (JF.isWindows()) {

src/javaforce/utils/ExecProject.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void run(String buildfile) throws Exception {
3535
if (cfg.length() == 0) {
3636
cfg = app + ".cfg";
3737
}
38-
String home = tools.getProperty("home");
38+
String user_home = System.getProperty("user.home");
3939
String exec = "jfexec";
4040
if (JF.isWindows()) {
4141
String apptype = tools.getProperty("apptype");
@@ -45,8 +45,6 @@ public void run(String buildfile) throws Exception {
4545
switch (apptype) {
4646
// case "window": exec += "w"; break; //for debugging purposes do not use 'w' version
4747
}
48-
} else {
49-
home = System.getProperty("HOME");
5048
}
5149

5250
Properties props = new Properties();
@@ -71,7 +69,7 @@ public void run(String buildfile) throws Exception {
7169
ShellProcess sp = new ShellProcess();
7270
sp.addListener(this);
7371
ArrayList<String> cmd = new ArrayList<String>();
74-
cmd.add(home + File.separator + "bin" + File.separator + exec);
72+
cmd.add(user_home + File.separator + "bin" + File.separator + exec);
7573
cmd.add("-cp");
7674
if (JF.isWindows()) {
7775
cmd.add(classpath);

src/javaforce/utils/GenExecutable.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ public static void main(String[] args) {
2626
public void run(String buildfile) throws Exception {
2727
tools = new BuildTools();
2828
if (!tools.loadXML(buildfile)) throw new Exception("error loading " + buildfile);
29-
String home = tools.getProperty("home");
30-
String HOME = System.getenv("HOME");
29+
String user_home = System.getProperty("user.home");
3130
String app = tools.getProperty("app");
3231
String apptype = tools.getProperty("apptype");
3332
String ico = tools.getProperty("ico");
@@ -50,7 +49,7 @@ public void run(String buildfile) throws Exception {
5049
case "client": app = app + "-client"; break;
5150
case "server": app = app + "-server"; break;
5251
}
53-
if (!JF.copyFile(home + "/native/win64" + type + ".exe", app + ".exe")) {
52+
if (!JF.copyFile(user_home + "/bin/win64" + type + ".exe", app + ".exe")) {
5453
throw new Exception("copy error:" + app + ".exe");
5554
}
5655
if (!new File(app + ".exe").exists()) {
@@ -63,7 +62,7 @@ public void run(String buildfile) throws Exception {
6362
case "client": app = app + "-client"; break;
6463
case "server": app = app + "-server"; break;
6564
}
66-
JF.copyFile(HOME + "/bin/mac64.bin", app);
65+
JF.copyFile(user_home + "/bin/mac64.bin", app);
6766
} else {
6867
//linux
6968
switch (apptype) {
@@ -72,7 +71,7 @@ public void run(String buildfile) throws Exception {
7271
case "client": app = app + "-client"; break;
7372
case "server": app = app + "-server"; break;
7473
}
75-
JF.copyFile(HOME + "/bin/linux64" + type + ".bin", app + ".bin");
74+
JF.copyFile(user_home + "/bin/linux64" + type + ".bin", app + ".bin");
7675
ResourceManager.main(new String[] {app + ".bin", cfg});
7776
}
7877
System.out.println("Native Executable generated!");

0 commit comments

Comments
 (0)