Skip to content

Commit

Permalink
Multi-platform install process
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Apr 19, 2024
1 parent 4605031 commit 3d1d9e1
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 39 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install haxe-manager
run: |
sh ./install.sh --skip-defaults
./install.sh
- name: Check env
run: |
Expand Down Expand Up @@ -63,7 +63,9 @@ jobs:
- name: Install haxe-manager
run: |
sh ./install.sh --skip-defaults
./install.bat
dir bin
dir current
- name: Check env
run: |
Expand All @@ -84,5 +86,5 @@ jobs:
dir versions
hx-select dev
dir current
haxe.exe --version
current/haxe.exe --version
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@ versions/
builds/
current/
data/
bin/*
!bin/hx
!bin/haxe
!bin/haxelib
!bin/hx-download*
!bin/hx-select*
bin/
1 change: 0 additions & 1 deletion bin/haxe

This file was deleted.

1 change: 0 additions & 1 deletion bin/haxelib

This file was deleted.

8 changes: 0 additions & 8 deletions bin/hx-select-test

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@ECHO OFF

SET ROOT=%~dp0

MKDIR "releases"
MKDIR "versions"
MKDIR "current"
MKDIR "bin"

ECHO F | XCOPY /S /Q /Y /F "extra/hx-download.bat" "bin/hx-download.bat"
ECHO F | XCOPY /S /Q /Y /F "extra/hx-select.bat" "bin/hx-select.bat"

MKLINK "versions/5.0.0-alpha.1+569e52e" "build/windows64_569e52e"
MKLINK "current/std" "build/windows64_569e52e/std"
MKLINK "current/haxe.exe" "build/windows64_569e52e/haxe.exe"
MKLINK "current/haxelib.exe" "build/windows64_569e52e/haxelib.exe"

MKLINK "bin/haxe.exe" "current/haxe.exe"
MKLINK "bin/haxelib.exe" "current/haxe.exe"

build/windows64_569e52e/haxe.exe -version
current/haxe.exe -version
bin/haxe.exe -version
haxe.exe -version

ECHO "Please add %ROOT%/bin to your PATH"
ECHO "Please set HAXE_STD_PATH to %ROOT%/current/std"
55 changes: 35 additions & 20 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,50 @@ ROOT=$(dirname $(readlink -f $0))

mkdir -p "$ROOT/releases"
mkdir -p "$ROOT/versions"
mkdir -p "$ROOT/bin"

# Install base tools
cp extra/hx bin/
cp extra/hx-download bin/
cp extra/hx-select bin/

# Install fzf if needed
if ! [ -x "$(command -v fzf)" ]; then
cd "$ROOT/bin"

if [[ "$OSTYPE" == "msys" ]]; then
# TODO: install fzf on windows if needed
echo "No fzf support for windows (yet)"
else
BUILD_OS="linux"
if [[ "$OSTYPE" == "darwin"* ]]; then
BUILD_OS="darwin"
fi

wget "https://github.com/junegunn/fzf-bin/releases/download/0.17.4/fzf-0.17.4-${BUILD_OS}_amd64.tgz"
tar -xf "fzf-0.17.4-${BUILD_OS}_amd64.tgz"
rm "fzf-0.17.4-${BUILD_OS}_amd64.tgz"
cd - > /dev/null
BUILD_OS="linux"
if [[ "$OSTYPE" == "darwin"* ]]; then
BUILD_OS="darwin"
fi

wget "https://github.com/junegunn/fzf-bin/releases/download/0.17.4/fzf-0.17.4-${BUILD_OS}_amd64.tgz"
tar -xf "fzf-0.17.4-${BUILD_OS}_amd64.tgz"
rm "fzf-0.17.4-${BUILD_OS}_amd64.tgz"
cd - > /dev/null
fi

# TODO: properly parse args (--skip-defaults)
if [ -z "$1" ]; then
# Download some versions
PATH=$PATH:$ROOT/bin hx-download "4.3.4"
PATH=$PATH:$ROOT/bin hx-download "latest"
# Setup included Haxe version
if ! [ -e "versions/5.0.0-alpha.1+569e52e" ]; then
BUILD_OS="linux64"
if [[ "$OSTYPE" == "darwin"* ]]; then
BUILD_OS="mac"
fi

ln -s "../build/${BUILD_OS}_569e52e" "versions/5.0.0-alpha.1+569e52e"
fi

# Expose haxe command
if ! [ -e "bin/haxe" ]; then
ln -s ../current/haxe bin/haxe
fi

# Expose haxelib command
if ! [ -e "bin/haxelib" ]; then
ln -s ../current/haxelib bin/haxelib
fi

# Select default version
PATH=$PATH:$ROOT/bin hx-select "4.3.4"
if ! [ -e "current/haxe" ]; then
hx-select "5.0.0-alpha.1+569e52e"
fi

echo "Please add $ROOT/bin to your PATH"
Expand Down

0 comments on commit 3d1d9e1

Please sign in to comment.