Skip to content

Commit

Permalink
Fix #118: support older CPUs (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude authored Dec 20, 2023
1 parent e817038 commit 11b1696
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 20 deletions.
25 changes: 6 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
working_directory: ~/repo
environment:
LEIN_ROOT: "true"
GRAALVM_HOME: /home/circleci/graalvm-ce-java11-22.3.0
GRAALVM_HOME: /home/circleci/graalvm-21.0.1
DEPS_CLJ_PLATFORM: linux # used in release script
# BABASHKA_TEST_ENV: native
steps:
Expand Down Expand Up @@ -114,13 +114,7 @@ jobs:
sudo apt-get -y install gcc g++ zlib1g-dev
- run:
name: Download GraalVM
command: |
cd ~
if ! [ -d graalvm-ce-java11-22.3.0 ]; then
curl -O -sL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java11-linux-amd64-22.3.0.tar.gz
tar xzf graalvm-ce-java11-linux-amd64-22.3.0.tar.gz
fi
"$GRAALVM_HOME/bin/gu" install native-image || true
command: script/install-graalvm
- run:
name: Build binary
command: |
Expand All @@ -137,7 +131,7 @@ jobs:
- save_cache:
paths:
- ~/.m2
- ~/graalvm-ce-java11-22.3.0
- ~/graalvm
key: linux-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }}
- store_artifacts:
path: /tmp/release
Expand All @@ -146,7 +140,7 @@ jobs:
macos:
xcode: "14.0.0"
environment:
GRAALVM_HOME: /Users/distiller/graalvm-ce-java11-22.3.0/Contents/Home
GRAALVM_HOME: /Users/distiller/graalvm-21.0.1/Contents/Home
DEPS_CLJ_PLATFORM: macos # used in release script
steps:
- checkout
Expand All @@ -168,14 +162,7 @@ jobs:
.circleci/script/install-leiningen
- run:
name: Download GraalVM
command: |
cd ~
ls -la
if ! [ -d graalvm-ce-java11-22.3.0 ]; then
curl -O -sL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java11-darwin-amd64-22.3.0.tar.gz
tar xzf graalvm-ce-java11-darwin-amd64-22.3.0.tar.gz
fi
"$GRAALVM_HOME/bin/gu" install native-image || true
command: script/install-graalvm
- run:
name: Build binary
command: |
Expand All @@ -192,7 +179,7 @@ jobs:
- save_cache:
paths:
- ~/.m2
- ~/graalvm-ce-java11-22.3.0
- ~/graalvm
key: mac-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }}
- store_artifacts:
path: /tmp/release
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ DEPS_CLJ_TOOLS_VERSION=1.11.1.1165 bb clojure

[deps.clj](https://github.com/borkdude/deps.clj): a faithful port of the clojure CLI bash script to Clojure

## Unreleased

- Support older CPUs for native-image builds

## 1.11.1.1429

- Catch up with CLI `1.11.1.1429`
Expand Down
4 changes: 3 additions & 1 deletion bb/tasks.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"--no-fallback"
"--verbose"
"--no-server"
"-J-Xmx3g"))
"-J-Xmx3g"
"-march=compatibility"
"-O1"))
(p/shell lein "clean")
(p/shell "./deps" "-Spath" "-Sdeps" "{:deps {borkdude/deps.clj {:mvn/version \"0.0.1\"}}}")))
36 changes: 36 additions & 0 deletions script/install-graalvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -euo pipefail

INSTALL_DIR="${1:-$HOME}"

GRAALVM_VERSION="${GRAALVM_VERSION:-21.0.1}"

GRAALVM_PLATFORM=$DEPS_CLJ_PLATFORM

case "${DEPS_CLJ_ARCH:-}" in
aarch64)
GRAALVM_ARCH="aarch64"
;;
*)
GRAALVM_ARCH="x64"
;;
esac

GRAALVM_DIR_NAME="graalvm-$GRAALVM_VERSION"
GRAALVM_FILENAME="graalvm-jdk-${GRAALVM_VERSION}_${GRAALVM_PLATFORM}-${GRAALVM_ARCH}_bin.tar.gz"
DOWNLOAD_URL="https://download.oracle.com/graalvm/21/archive/${GRAALVM_FILENAME}"

pushd "$INSTALL_DIR" >/dev/null

if ! [ -d "$GRAALVM_DIR_NAME" ]; then
echo "Downloading GraalVM $GRAALVM_PLATFORM-$GRAALVM_ARCH-$GRAALVM_VERSION on '$PWD'..."
echo "$DOWNLOAD_URL"
curl -LO "$DOWNLOAD_URL"
ls -la
mkdir "$GRAALVM_DIR_NAME"
tar xzvf "$GRAALVM_FILENAME" -C "$GRAALVM_DIR_NAME" --strip-components 1
ls -la "$GRAALVM_DIR_NAME"
fi

popd >/dev/null

0 comments on commit 11b1696

Please sign in to comment.