Skip to content

Commit

Permalink
7537: Build script assumes that Darwin always targets x86_64
Browse files Browse the repository at this point in the history
Reviewed-by: hirt
  • Loading branch information
parttimenerd authored and Patrick Reinhart committed Jan 21, 2022
1 parent c646b14 commit baa6c77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@ to use when launching, add -vm and the path to a directory where a JDK java laun
Here is an example for Mac OS X:

```bash
# on x86_64
target/products/org.openjdk.jmc/macosx/cocoa/x86_64/JDK\ Mission\ Control.app/Contents/MacOS/jmc

# on M1
target/products/org.openjdk.jmc/macosx/cocoa/aarch64/JDK\ Mission\ Control.app/Contents/MacOS/jmc
```

Here is an example for Linux:
Expand Down
15 changes: 9 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ set -u # a reference to any variable you have not previously defined causes the
set -o pipefail # If any command in a pipeline fails, that return code will be used as the return code of the whole pipeline

PROGNAME=$(basename "$0")

ARCH="x86_64"
if [[ "`uname -m`" =~ "arm64" ]]; then
ARCH="aarch64"
fi
JETTY_PID=""
BASEDIR=""
JMC_DIR=""
Expand Down Expand Up @@ -121,9 +124,9 @@ function packageJmc() {
mvn package --log-file "${packageLog}"

if [[ "${OSTYPE}" =~ "linux"* ]]; then
echo "You can now run jmc by calling \"${PROGNAME} --run\" or \"${BASEDIR}/products/org.openjdk.jmc/linux/gtk/x86_64/JDK\ Mission\ Control/jmc\""
echo "You can now run jmc by calling \"${PROGNAME} --run\" or \"${BASEDIR}/products/org.openjdk.jmc/linux/gtk/${ARCH}/JDK\ Mission\ Control/jmc\""
elif [[ "${OSTYPE}" =~ "darwin"* ]]; then
echo "You can now run jmc by calling \"${PROGNAME} --run\" or \"${BASEDIR}/products/org.openjdk.jmc/macosx/cocoa/x86_64/JDK\ Mission\ Control.app/Contents/MacOS/jmc\""
echo "You can now run jmc by calling \"${PROGNAME} --run\" or \"${BASEDIR}/products/org.openjdk.jmc/macosx/cocoa/${ARCH}/JDK\ Mission\ Control.app/Contents/MacOS/jmc\""
else
err_log "unknown OS type: \"${OSTYPE}\". Please check your package in \"${BASEDIR}/products/org.openjdk.jmc/\""
fi
Expand Down Expand Up @@ -193,9 +196,9 @@ function clean() {
function run() {
local path
if [[ "${OSTYPE}" =~ "linux"* ]]; then
path="${BASEDIR}/products/org.openjdk.jmc/linux/gtk/x86_64/JDK Mission Control/jmc"
path="${BASEDIR}/products/org.openjdk.jmc/linux/gtk/${ARCH}/JDK Mission Control/jmc"
elif [[ "${OSTYPE}" =~ "darwin"* ]]; then
path="${BASEDIR}/products/org.openjdk.jmc/macosx/cocoa/x86_64/JDK Mission Control.app/Contents/MacOS/jmc"
path="${BASEDIR}/products/org.openjdk.jmc/macosx/cocoa/${ARCH}/JDK Mission Control.app/Contents/MacOS/jmc"
else
err_log "unknown OS type: ${OSTYPE}"
exit 1
Expand Down Expand Up @@ -326,4 +329,4 @@ function checkPreconditions() {
}

checkPreconditions
parseArgs "$@"
parseArgs "$@"

0 comments on commit baa6c77

Please sign in to comment.