diff --git a/samples/csvparser/build.sh b/samples/csvparser/build.sh index a44a9b766d0..bc48c94b84f 100755 --- a/samples/csvparser/build.sh +++ b/samples/csvparser/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" if [ x$TARGET == x ]; then case "$OSTYPE" in diff --git a/samples/gitchurn/build.sh b/samples/gitchurn/build.sh index 4967e3afdda..58fdd565071 100755 --- a/samples/gitchurn/build.sh +++ b/samples/gitchurn/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" CFLAGS_macbook="-I/opt/local/include -I/usr/local/include" CFLAGS_linux=-I/usr/include diff --git a/samples/gtk/build.sh b/samples/gtk/build.sh index aac610f2fc0..2372df10573 100755 --- a/samples/gtk/build.sh +++ b/samples/gtk/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" IPREFIX_macbook=-I/opt/local/include IPREFIX_linux=-I/usr/include diff --git a/samples/html5Canvas/build.sh b/samples/html5Canvas/build.sh index c7411e17709..26c3cb9d3ed 100755 --- a/samples/html5Canvas/build.sh +++ b/samples/html5Canvas/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" if [ x$TARGET == x ]; then case "$OSTYPE" in @@ -41,4 +37,4 @@ echo "Artifact path is $DIR/build/bin/html5Canvas.wasm" echo "Artifact path is $DIR/build/bin/html5Canvas.wasm.js" echo "Check out $DIR/index.html" echo "Serve $DIR/ by an http server for the demo" -# For example run: python -m SimpleHTTPServer 8080 +# For example run: python -m SimpleHTTPServer 8080 diff --git a/samples/konan.sh b/samples/konan.sh new file mode 100644 index 00000000000..5df5d4d46cd --- /dev/null +++ b/samples/konan.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [ -z "$KONAN_HOME" ]; then + PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" +else + PATH="$KONAN_HOME/bin:$PATH" +fi \ No newline at end of file diff --git a/samples/libcurl/build.sh b/samples/libcurl/build.sh index c6fe4ce8d36..e86fcf50210 100755 --- a/samples/libcurl/build.sh +++ b/samples/libcurl/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" CFLAGS_macbook=-I/opt/local/include CFLAGS_linux="-I /usr/include -I /usr/include/x86_64-linux-gnu" diff --git a/samples/nonBlockingEchoServer/build.sh b/samples/nonBlockingEchoServer/build.sh index 523e3aa81b2..45781bc553d 100755 --- a/samples/nonBlockingEchoServer/build.sh +++ b/samples/nonBlockingEchoServer/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" if [ x$TARGET == x ]; then case "$OSTYPE" in diff --git a/samples/objc/build.sh b/samples/objc/build.sh index a743454cc98..a22d2b518cb 100755 --- a/samples/objc/build.sh +++ b/samples/objc/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" mkdir -p $DIR/build/bin/ diff --git a/samples/opengl/build.sh b/samples/opengl/build.sh index 8853cf65e62..ce6fb7f069e 100755 --- a/samples/opengl/build.sh +++ b/samples/opengl/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" if [ x$TARGET == x ]; then case "$OSTYPE" in diff --git a/samples/socket/build.sh b/samples/socket/build.sh index 5f1d83c9b33..a346cf92c21 100755 --- a/samples/socket/build.sh +++ b/samples/socket/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" mkdir -p $DIR/build/bin/ diff --git a/samples/tensorflow/build.sh b/samples/tensorflow/build.sh index 08d13a33ba3..1b11a0d8d47 100755 --- a/samples/tensorflow/build.sh +++ b/samples/tensorflow/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" $DIR/downloadTensorflow.sh diff --git a/samples/tetris/build.sh b/samples/tetris/build.sh index b3c01865616..416c7310ea1 100755 --- a/samples/tetris/build.sh +++ b/samples/tetris/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" DEPS="$HOME/.konan/dependencies" diff --git a/samples/uikit/build.sh b/samples/uikit/build.sh index d5d063de0cf..9218dab8a46 100755 --- a/samples/uikit/build.sh +++ b/samples/uikit/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" mkdir -p $DIR/build/bin/ diff --git a/samples/workers/build.sh b/samples/workers/build.sh index 5807eef7b37..fd2f49c0c8a 100755 --- a/samples/workers/build.sh +++ b/samples/workers/build.sh @@ -2,11 +2,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ -z "$KONAN_HOME" ]; then - PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH" -else - PATH="$KONAN_HOME/bin:$PATH" -fi +source "$DIR/../konan.sh" SUFFIX=kexe if [ x$TARGET == x ]; then