Skip to content

Commit

Permalink
fix: Add .exe file extension to Windows kamel binary
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton authored and valdar committed May 21, 2019
1 parent 9cfdec2 commit 8eb1a93
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions script/cross_compile.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh
#!/bin/bash

location=$(dirname $0)
builddir=$(realpath $location/../xtmp)
builddir=$(realpath ${location}/../xtmp)

rm -rf $builddir
rm -rf ${builddir}

basename=camel-k-client

Expand All @@ -15,22 +15,27 @@ fi
version=$1

cross_compile () {
label=$1
local label=$1
local extension=""
export GOOS=$2
export GOARCH=$3

targetdir=$builddir/$label
go build -o $targetdir/kamel ./cmd/kamel/...
if [ "${GOOS}" == "windows" ]; then
extension=".exe"
fi

cp $location/../LICENSE $targetdir/
cp $location/../NOTICE $targetdir/
targetdir=${builddir}/${label}
go build -o ${targetdir}/kamel${extension} ./cmd/kamel/...

pushd . && cd $targetdir && tar -zcvf ../../$label.tar.gz . && popd
cp ${location}/../LICENSE ${targetdir}/
cp ${location}/../NOTICE ${targetdir}/

pushd . && cd ${targetdir} && tar -zcvf ../../${label}.tar.gz . && popd
}

cross_compile $basename-$version-linux-64bit linux amd64
cross_compile $basename-$version-mac-64bit darwin amd64
cross_compile $basename-$version-windows-64bit windows amd64
cross_compile ${basename}-${version}-linux-64bit linux amd64
cross_compile ${basename}-${version}-mac-64bit darwin amd64
cross_compile ${basename}-${version}-windows-64bit windows amd64


rm -rf $builddir
rm -rf ${builddir}

0 comments on commit 8eb1a93

Please sign in to comment.