Repository navigation
Expand file tree
/
Copy pathcommon.include
More file actions
117 lines (103 loc) · 3.33 KB
/
Copy pathcommon.include
File metadata and controls
117 lines (103 loc) · 3.33 KB
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
#!/bin/sh
# Commonly useful constants and functions. Include via:
#
# . "${0%/*}/common.include"
set -e
track="$1"
case "$track" in
latest)
platforms='linux-arm64 linux64 macos-arm64 macos64 win-arm64 win64'
fiji_nojava=fiji-latest-portable-nojava
fiji_dir=Fiji
;;
stable)
platforms='linux64 macosx win32 win64'
fiji_nojava=fiji-stable-portable-nojava
fiji_dir=Fiji.app
;;
*)
echo "Usage: $0 latest|stable"
exit 1
;;
esac
cd "$(dirname "$0")"
die() { >&2 echo "[ERROR] $1"; exit 1; }
verify_fiji_dir() {
test -d "$fiji_dir" || die "Fiji folder '$fiji_dir' does not exist."
}
long_platform() {
: << 'DOC'
Get the long platform name, used for Jaunch-based launcher
filename suffixes and Fiji downloadable archive filenames.
DOC
platform=$1
case "$platform" in
linux-arm64) echo linux-arm64 ;;
linux-x32|linux32|linux) echo linux-x32 ;;
linux-x64|linux64) echo linux-x64 ;;
macos-arm64) echo macos-arm64 ;;
macos-x64|macos64) echo macos-x64 ;;
windows-arm64|win-arm64) echo windows-arm64 ;;
windows-x32|win32) echo windows-x32 ;;
windows-x64|win64) echo windows-x64 ;;
*) echo "$platform" ;;
esac
}
short_platform() {
: << 'DOC'
Get the short platform name, used for platform-specific
subdirectories beneath the jars and lib folders.
DOC
platform=$(long_platform "$1")
case "$platform" in
linux-arm64) echo linux-arm64 ;;
linux-x32) echo linux32 ;;
linux-x64) echo linux64 ;;
macos-arm64) echo macos-arm64 ;;
macos-x64) echo macos64 ;;
windows-arm64) echo win-arm64 ;;
windows-x32) echo win32 ;;
windows-x64) echo win64 ;;
*) echo "$platform" ;;
esac
}
java_dir() {
: << 'DOC'
Get the platform-specific subdirectory beneath
Fiji/java where JDK/JRE installations should reside.
This almost completely coincides with the short platform name,
with the exception of linux32 and linux64 in Fiji stable.
DOC
track=$1
platform=$2
javaDir=$(short_platform "$platform")
case "$track:$javaDir" in
# The old ImageJ Launcher expects one of these folders:
# linux, linux-amd64, macosx, win32, win64
stable:linux32) echo linux ;;
stable:linux64) echo linux-amd64 ;;
*) echo "$javaDir" ;;
esac
}
launchers() {
: << 'DOC'
Get the list of native launchers to include for a given track + platform.
DOC
track=$1
platform=$2
short=$(short_platform "$platform")
long=$(long_platform "$platform")
case "$track:$short" in
latest:macos*) echo 'Fiji.app' ;;
stable:macos*) echo 'Contents Fiji.app' ;;
# Note: Windows arm64 requires jaunch-windows-x64 configurator,
# because KMP does not support arm64, so the native launcher invokes
# the x64 configurator via Windows arm64's x64 compatibility layer.
latest:win-arm64) echo "fiji-$long.exe config/jaunch/jaunch-windows-x64.exe" ;;
latest:win*) echo "fiji-$long.exe config/jaunch/jaunch-$long.exe" ;;
stable:win*) echo "fiji-$long.exe config/jaunch/jaunch-$long.exe ImageJ-$short.exe" ;;
latest:*) echo "fiji-$long config/jaunch/jaunch-$long" ;;
stable:*) echo "fiji-$long config/jaunch/jaunch-$long ImageJ-$short" ;;
esac
}
notify() { printf "\e[0;33m--> $@\e[0m\n"; }