Skip to content

Commit

Permalink
Inject target C bindings to crystal_path [temporary workaround]
Browse files Browse the repository at this point in the history
TODO: revert after the next release of Crystal.
  • Loading branch information
ysbaddaden committed May 5, 2016
1 parent 793a178 commit 00f1efa
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion bin/crystal
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,47 @@ remove_path_item() {

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

# required to build Crystal 0.16.0 with Crystal 0.15.0 (because the previous
# compiler won't append the target folder).
# TODO: remove this + the CRYSTAL_PATH injection below 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 | egrep -q "(i[3456]86)-"); then
if (echo $TARGET_TRIPLE | grep -q "linux-"); then
if (echo $TARGET_TRIPLE | grep -q "gnu"); then
TRIPLE=i686-linux-gnu
elif (echo $TARGET_TRIPLE | grep -q "musl"); then
TRIPLE=i686-linux-musl
fi
#elif (echo $TARGET_TRIPLE | grep -q "darwin"); then
# TRIPLE=i686-macosx-darwin
#elif (echo $TARGET_TRIPLE | grep -q "freebsd"); then
# TRIPLE=i686-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 00f1efa

Please sign in to comment.