Skip to content

Commit

Permalink
Inject lib_c target to crystal_path [temporary workaround]
Browse files Browse the repository at this point in the history
Please revert after the next release of Crystal.
  • Loading branch information
ysbaddaden committed Apr 11, 2016
1 parent e854c2d commit b13e5f1
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion bin/crystal
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,46 @@ remove_path_item() {

##############################################################################

# required to build Crystal 0.16.0 from Crystal 0.15.0
# TODO: remove once 0.16.0 is released!

LLVM_CONFIG=`command -v llvm-config-3.6 lllvm-config36 lvm-config-3.5 llvm-config35 llvm-config`
TARGET_TRIPLE=`$LLVM_CONFIG --host-target`

if (echo $TARGET_TRIPLE | grep -q "x86_64-"); then
if (echo $TARGET_TRIPLE | grep -q "linux-"); then
if (echo $TARGET_TRIPLE | grep -q "gnu"); then
TRIPLE=x86_64-linux-gnu
elif (echo $TARGET_TRIPLE | grep -q "musl"); then
TRIPLE=x86_64-linux-musl
fi
elif (echo $TARGET_TRIPLE | grep -q "darwin"); then
TRIPLE=x86_64-macosx-darwin
elif (echo $TARGET_TRIPLE | grep -q "freebsd"); then
TRIPLE=x86_64-portbld-freebsd
fi
elif (echo $TARGET_TRIPLE | grep -q "x86-"); then
if (echo $TARGET_TRIPLE | grep -q "linux-"); then
if (echo $TARGET_TRIPLE | grep -q "gnu"); then
TRIPLE=x86-linux-gnu
elif (echo $TARGET_TRIPLE | grep -q "musl"); then
TRIPLE=x86-linux-musl
fi
#elif (echo $TARGET_TRIPLE | grep -q "darwin"); then
# TRIPLE=x86-macosx-darwin
#elif (echo $TARGET_TRIPLE | grep -q "freebsd"); then
# TRIPLE=x86-portbld-freebsd
fi
fi

##############################################################################

SCRIPT_PATH="$(realpath "$0")"
SCRIPT_ROOT="$(dirname "$SCRIPT_PATH")"
CRYSTAL_ROOT="$(dirname "$SCRIPT_ROOT")"
CRYSTAL_DIR="$CRYSTAL_ROOT/.build"

export CRYSTAL_PATH=$CRYSTAL_ROOT/src:libs
export CRYSTAL_PATH=$CRYSTAL_ROOT/src:$CRYSTAL_ROOT/src/lib_c/$TRIPLE:libs

if [ -x "$CRYSTAL_DIR/crystal" ]
then
Expand Down

0 comments on commit b13e5f1

Please sign in to comment.