From 6eb27641413591548b1cc0dab85c1fc8cfca690b Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Thu, 26 Oct 2017 16:26:31 +0300 Subject: [PATCH] Small samples cleanup --- samples/gitchurn/build.gradle | 7 ++++++- samples/gitchurn/build.sh | 4 ++-- samples/gtk/build.sh | 9 ++------- samples/socket/build.sh | 16 +--------------- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/samples/gitchurn/build.gradle b/samples/gitchurn/build.gradle index aa8ff87b284..7232ab562c2 100644 --- a/samples/gitchurn/build.gradle +++ b/samples/gitchurn/build.gradle @@ -2,7 +2,12 @@ apply plugin: 'konan' konanArtifacts { interop('libgit2') { - includeDirs '/opt/local/include', '/usr/include', '/usr/local/include' + target('linux') { + includeDirs '/usr/include' + } + target('macbook') { + includeDirs '/opt/local/include', '/usr/local/include' + } } program('GitChurn') { diff --git a/samples/gitchurn/build.sh b/samples/gitchurn/build.sh index 100676f2c92..12e0895f3e8 100755 --- a/samples/gitchurn/build.sh +++ b/samples/gitchurn/build.sh @@ -3,7 +3,7 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH -CFLAGS_macbook="-I/opt/local/include -compilerOpts -I/usr/local/include" +CFLAGS_macbook="-I/opt/local/include -I/usr/local/include" CFLAGS_linux=-I/usr/include if [ x$TARGET == x ]; then @@ -24,7 +24,7 @@ COMPILER_ARGS=${!var} # add -opt for an optimized build. mkdir -p $DIR/build/c_interop/ mkdir -p $DIR/build/bin/ -cinterop -compilerOpts $CFLAGS -def $DIR/src/main/c_interop/libgit2.def -target $TARGET \ +cinterop -compilerOpts "$CFLAGS" -def $DIR/src/main/c_interop/libgit2.def -target $TARGET \ -o $DIR/build/c_interop/libgit2 || exit 1 konanc -target $TARGET $DIR/src/main/kotlin -library $DIR/build/c_interop/libgit2 \ diff --git a/samples/gtk/build.sh b/samples/gtk/build.sh index 3e757bb225b..d5265490c4c 100755 --- a/samples/gtk/build.sh +++ b/samples/gtk/build.sh @@ -4,7 +4,6 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH IPREFIX_macbook=-I/opt/local/include -#IPREFIX_macbook=-I/usr/local/include IPREFIX_linux=-I/usr/include if [ x$TARGET == x ]; then @@ -17,17 +16,13 @@ fi var=IPREFIX_${TARGET} IPREFIX="${!var}" -var=LINKER_ARGS_${TARGET} -LINKER_ARGS=${!var} -var=COMPILER_ARGS_${TARGET} -COMPILER_ARGS=${!var} # add -opt for an optimized build. mkdir -p $DIR/build/c_interop/ mkdir -p $DIR/build/bin/ echo "Generating GTK stubs, may take few mins depending on the hardware..." -cinterop -J-Xmx8g -copt $IPREFIX/atk-1.0 -compilerOpts $IPREFIX/gdk-pixbuf-2.0 -copt $IPREFIX/cairo -copt $IPREFIX/pango-1.0 \ - -copt -I/opt/local/lib/glib-2.0/include -copt $IPREFIX/gtk-3.0 -copt $IPREFIX/glib-2.0 \ +cinterop -J-Xmx8g -compilerOpts "$IPREFIX/atk-1.0 $IPREFIX/gdk-pixbuf-2.0 $IPREFIX/cairo $IPREFIX/pango-1.0 \ + -I/opt/local/lib/glib-2.0/include $IPREFIX/gtk-3.0 $IPREFIX/glib-2.0" \ -def $DIR/src/main/c_interop/gtk3.def -target $TARGET -o $DIR/build/c_interop/gtk3 || exit 1 konanc -target $TARGET $DIR/src/main/kotlin -library $DIR/build/c_interop/gtk3 \ diff --git a/samples/socket/build.sh b/samples/socket/build.sh index b1d7fd628a8..70c81c84c70 100755 --- a/samples/socket/build.sh +++ b/samples/socket/build.sh @@ -3,23 +3,9 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH -if [ x$TARGET == x ]; then -case "$OSTYPE" in - darwin*) TARGET=macbook ;; - linux*) TARGET=linux ;; - *) echo "unknown: $OSTYPE" && exit 1;; -esac -fi - -var=CFLAGS_${TARGET} -CFLAGS=${!var} -var=COMPILER_ARGS_${TARGET} -COMPILER_ARGS=${!var} # add -opt for an optimized build. - -mkdir -p $DIR/build/c_interop/ mkdir -p $DIR/build/bin/ -konanc $COMPILER_ARGS -target $TARGET $DIR/src/main/kotlin/EchoServer.kt \ +konanc $COMPILER_ARGS $DIR/src/main/kotlin/EchoServer.kt \ -o $DIR/build/bin/EchoServer || exit 1 echo "Artifact path is $DIR/build/bin/EchoServer.kexe"