diff --git a/.gitignore b/.gitignore index e3c41d050e8b5279e300d0b200ed482d57562c9e..031b02770b649c7351661b079998805457fe13ba 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ openxt *.tar.gz +bin/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ae470e630c7bdbe48baf9dd3812487235ab823fa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +######## Docker build guide +# tools/build-and-pack.sh linux64-only +# sudo docker build -f Dockerfile -t recolic/openxt . + +# Requires dotnet-core 5.0.x. dotnet 3.x can not build .net framework project. +from mcr.microsoft.com/dotnet/sdk:5.0 + +copy *.tar.gz /tmp +run cd /tmp && tar xvzf openxt*.tar.gz && cp bin/* /usr/bin/ +run openxt || echo "" + + + diff --git a/main.go b/main.go index 7d158bd03355d1dfcd26c4545c4e499085eba31c..1cec3771c124e7374da2857f446d1cba60d40cbe 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,7 @@ import ( // Some options here. Would be improved in beta release. const DEDUCT_PKGNAME_FROM_VARNAME = true const USE_PROJECT_NETVER_INSTEAD_OF_HINTPATH_NETVER = false -const OPENXT_VERSION = "1.3-1" +const OPENXT_VERSION = "1.3-2" func print_help_and_exit() { println("Usage: openxt <subcommand> [options...]") diff --git a/tools/build-and-pack.sh b/tools/build-and-pack.sh index cb21959c93edd1f0155ef074de4f38145d0c814f..b84731705a05a83a9590853e912f4ba80c617f67 100755 --- a/tools/build-and-pack.sh +++ b/tools/build-and-pack.sh @@ -11,12 +11,15 @@ function build () { arch="$2" echo "Building OpenXT $version for $os:$arch ..." - [[ "$os" = "windows" ]] && bin_tail=".exe" || bin_tail="" + [[ "$os" = windows ]] && bin_tail=".exe" || bin_tail="" rm -rf bin/ - GOOS="$os" GOARCH="$arch" go build -o "bin/openxt$bin_tail" . && - GOOS="$os" GOARCH="$arch" go build -o "bin/csproj-to-5$bin_tail" tools/csproj-to-5/main.go && - GOOS="$os" GOARCH="$arch" go build -o "bin/nuget-download-package$bin_tail" tools/nuget-download-package/main.go tools/nuget-download-package/unzip.go && + # Static compilation for linux + [[ "$os" = linux ]] && xtra_flags=(-ldflags '-extldflags "-static"') && export CGO_ENABLED=0 || xtra_flags=() + + GOOS="$os" GOARCH="$arch" go build "${xtra_flags[@]}" -o "bin/openxt$bin_tail" . && + GOOS="$os" GOARCH="$arch" go build "${xtra_flags[@]}" -o "bin/csproj-to-5$bin_tail" tools/csproj-to-5/main.go && + GOOS="$os" GOARCH="$arch" go build "${xtra_flags[@]}" -o "bin/nuget-download-package$bin_tail" tools/nuget-download-package/main.go tools/nuget-download-package/unzip.go && tar cvzf "openxt-$version-$os-$arch.tar.gz" bin return $? @@ -24,6 +27,7 @@ function build () { # Just add architectures you want. Run `go tool dist list` for available architectures. build linux amd64 +[[ "$1" = "linux64-only" ]] && exit 0 build linux 386 build linux arm build linux arm64