Skip to content

Commit c48ffe9

Browse files
author
Brian J. Cardiff
authored
Use make update path (#69)
* Remove LIBRARY_PATH override in wrapper scripts * Remove PATH override in wrapper script * Update usage of main repo Makefile * Use compiler embedded CRYSTAL_PATH to get the library path The compiler binary uses blank CRYSTAL_CONFIG_PATH so it will only have lib (or whatever default it comes later) * Drop override if LIBRARY_PATH in docker images
1 parent f9cc295 commit c48ffe9

File tree

6 files changed

+8
-14
lines changed

6 files changed

+8
-14
lines changed

docker/alpine.Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,4 @@ RUN \
3333
apk add --update --no-cache --force-overwrite \
3434
llvm-dev llvm-static g++
3535

36-
ENV LIBRARY_PATH=/usr/lib/crystal/lib/
37-
3836
CMD ["/bin/sh"]

docker/ubuntu.Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,4 @@ RUN \
2626

2727
RUN ln -sf /usr/bin/ld.lld-8 /usr/bin/ld.lld
2828

29-
ENV LIBRARY_PATH=/usr/lib/crystal/lib/
30-
3129
CMD ["/bin/sh"]

linux/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ RUN git clone https://github.com/crystal-lang/crystal \
8585
&& git checkout ${crystal_sha1} \
8686
\
8787
&& make crystal stats=true static=true ${release:+release=true} \
88-
CRYSTAL_CONFIG_TARGET=${gnu_target} \
88+
CRYSTAL_CONFIG_TARGET=${gnu_target} CRYSTAL_CONFIG_LIBRARY_PATH= \
8989
&& ([ "$(ldd .build/crystal | wc -l)" -eq "1" ] || { echo './build/crystal is not statically linked'; ldd .build/crystal; exit 1; })
9090

9191
# Build shards

linux/files/crystal-wrapper

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ _canonicalize_file_path() {
9696

9797
SCRIPT_DIR="$(dirname "$(realpath "$0" || echo "$0")")"
9898
ROOT_DIR="$SCRIPT_DIR/.."
99-
100-
export CRYSTAL_PATH="${CRYSTAL_PATH:-"lib:$ROOT_DIR/share/crystal/src"}"
101-
export PATH="$ROOT_DIR/lib/crystal/bin:$PATH"
102-
export LIBRARY_PATH="$ROOT_DIR/lib/crystal/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"
99+
EMBEDDED_CRYSTAL_PATH=$("$ROOT_DIR/lib/crystal/bin/crystal" env CRYSTAL_PATH)
100+
export CRYSTAL_PATH="${CRYSTAL_PATH:-"$EMBEDDED_CRYSTAL_PATH:$ROOT_DIR/share/crystal/src"}"
103101
export CRYSTAL_LIBRARY_PATH="${CRYSTAL_LIBRARY_PATH:+$CRYSTAL_LIBRARY_PATH:}$ROOT_DIR/lib/crystal/lib"
104102

105103
exec "$ROOT_DIR/lib/crystal/bin/crystal" "${@}"

omnibus/config/software/crystal.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
llvm_bin = Omnibus::Software.load(project, "llvm_bin", nil)
2828
end
2929

30-
output_bin = "#{install_dir}/embedded/bin/crystal"
30+
output_path = "#{install_dir}/embedded/bin"
31+
output_bin = "#{output_path}/crystal"
3132

3233
if FIRST_RUN
3334
env["PATH"] = "#{project_dir}/deps:#{env["PATH"]}"
@@ -49,7 +50,7 @@
4950
command "mkdir .build", env: env
5051
command "echo #{Dir.pwd}", env: env
5152
command "cp #{Dir.pwd}/crystal-#{ohai['os']}-#{ohai['kernel']['machine']} .build/crystal", env: env
52-
command "bin/crystal build src/compiler/crystal.cr --release --no-debug -o #{output_bin} -D without_openssl -D without_zlib", env: env
53+
command "make crystal stats=true release=true FLAGS=--no-debug CRYSTAL_CONFIG_LIBRARY_PATH= O=#{output_path}", env: env
5354

5455
block do
5556
raise "Could not build crystal" unless File.exists?(output_bin)

omnibus/config/templates/crystal/crystal.erb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ _canonicalize_file_path() {
9696

9797
SCRIPT_PATH="$(dirname "$(realpath "$0" || echo $0)")"
9898
INSTALL_DIR="$(realpath "$SCRIPT_PATH/..")"
99-
export CRYSTAL_PATH=${CRYSTAL_PATH:-"lib:$INSTALL_DIR/src"}
100-
export PATH="$INSTALL_DIR/embedded/bin:$PATH"
101-
export LIBRARY_PATH="$INSTALL_DIR/embedded/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"
99+
EMBEDDED_CRYSTAL_PATH=$("$INSTALL_DIR/embedded/bin/crystal" env CRYSTAL_PATH)
100+
export CRYSTAL_PATH="${CRYSTAL_PATH:-"$EMBEDDED_CRYSTAL_PATH:$INSTALL_DIR/src"}"
102101
export CRYSTAL_LIBRARY_PATH="${CRYSTAL_LIBRARY_PATH:+$CRYSTAL_LIBRARY_PATH:}$INSTALL_DIR/embedded/lib"
103102
"$INSTALL_DIR/embedded/bin/crystal" "$@"

0 commit comments

Comments
 (0)