Skip to content

Commit bbe54d5

Browse files
authored
remove target from windows and darwin output filename (#79)
Co-authored-by: CrazyMax <[email protected]>
1 parent dcd9cf9 commit bbe54d5

File tree

8 files changed

+40
-35
lines changed

8 files changed

+40
-35
lines changed

doc/usage.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ xgo github.com/project-iris/iris
88
ls -al
99
```
1010
```text
11-
-rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-darwin-10.6-386
12-
-rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-darwin-10.6-amd64
11+
-rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-darwin-386
12+
-rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-darwin-amd64
1313
-rwxr-xr-x 1 root root 10135248 Nov 24 16:44 iris-linux-386
1414
-rwxr-xr-x 1 root root 12598472 Nov 24 16:44 iris-linux-amd64
1515
-rwxr-xr-x 1 root root 10040464 Nov 24 16:44 iris-linux-arm
16-
-rwxr-xr-x 1 root root 7516368 Nov 24 16:44 iris-windows-4.0-386.exe
17-
-rwxr-xr-x 1 root root 9549416 Nov 24 16:44 iris-windows-4.0-amd64.exe
16+
-rwxr-xr-x 1 root root 7516368 Nov 24 16:44 iris-windows-386.exe
17+
-rwxr-xr-x 1 root root 9549416 Nov 24 16:44 iris-windows-amd64.exe
1818
```
1919

2020
If the path is not a canonical import path, but rather a local path (starts with

doc/usage/branch-selection.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ xgo --branch release-branch.go1.4 golang.org/x/tools/cmd/goimports
1010
ls -al
1111
```
1212
```text
13-
-rwxr-xr-x 1 root root 4139868 Nov 24 16:40 goimports-darwin-10.6-386
14-
-rwxr-xr-x 1 root root 5186720 Nov 24 16:40 goimports-darwin-10.6-amd64
13+
-rwxr-xr-x 1 root root 4139868 Nov 24 16:40 goimports-darwin-386
14+
-rwxr-xr-x 1 root root 5186720 Nov 24 16:40 goimports-darwin-amd64
1515
-rwxr-xr-x 1 root root 4189456 Nov 24 16:40 goimports-linux-386
1616
-rwxr-xr-x 1 root root 5264136 Nov 24 16:40 goimports-linux-amd64
1717
-rwxr-xr-x 1 root root 4209416 Nov 24 16:40 goimports-linux-arm
18-
-rwxr-xr-x 1 root root 4348416 Nov 24 16:40 goimports-windows-4.0-386.exe
19-
-rwxr-xr-x 1 root root 5415424 Nov 24 16:40 goimports-windows-4.0-amd64.exe
18+
-rwxr-xr-x 1 root root 4348416 Nov 24 16:40 goimports-windows-386.exe
19+
-rwxr-xr-x 1 root root 5415424 Nov 24 16:40 goimports-windows-amd64.exe
2020
```

doc/usage/build-flags.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ A handful of flags can be passed to `go build`. The currently supported ones are
99
* `-ldflags=<flag list>`: arguments to pass on each go tool link invocation
1010
* `-buildmode=<mode>`: binary type to produce by the compiler
1111
* `-buildvcs=<value>`: whether to stamp binaries with version control information
12+
* `-trimpath`: remove all file system paths from the resulting executable

doc/usage/cgo-dependencies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ $ xgo --deps=https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2 --targets=windows
2323
ls -al
2424
```
2525
```text
26-
-rwxr-xr-x 1 root root 16315679 Nov 24 16:39 geth-windows-4.0-386.exe
27-
-rwxr-xr-x 1 root root 19452036 Nov 24 16:38 geth-windows-4.0-amd64.exe
26+
-rwxr-xr-x 1 root root 16315679 Nov 24 16:39 geth-windows-386.exe
27+
-rwxr-xr-x 1 root root 19452036 Nov 24 16:38 geth-windows-amd64.exe
2828
```
2929

3030
Some trivial arguments may be passed to the dependencies' configure script via `--depsargs`.

doc/usage/output-prefixing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ xgo -out iris-v0.3.2 github.com/project-iris/iris
99
ls -al
1010
```
1111
```text
12-
-rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-v0.3.2-darwin-10.6-386
13-
-rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-v0.3.2-darwin-10.6-amd64
12+
-rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-v0.3.2-darwin-386
13+
-rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-v0.3.2-darwin-amd64
1414
-rwxr-xr-x 1 root root 10135248 Nov 24 16:44 iris-v0.3.2-linux-386
1515
-rwxr-xr-x 1 root root 12598472 Nov 24 16:44 iris-v0.3.2-linux-amd64
1616
-rwxr-xr-x 1 root root 10040464 Nov 24 16:44 iris-v0.3.2-linux-arm
17-
-rwxr-xr-x 1 root root 7516368 Nov 24 16:44 iris-v0.3.2-windows-4.0-386.exe
18-
-rwxr-xr-x 1 root root 9549416 Nov 24 16:44 iris-v0.3.2-windows-4.0-amd64.exe
17+
-rwxr-xr-x 1 root root 7516368 Nov 24 16:44 iris-v0.3.2-windows-386.exe
18+
-rwxr-xr-x 1 root root 9549416 Nov 24 16:44 iris-v0.3.2-windows-amd64.exe
1919
```

doc/usage/package-selection.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ xgo --pkg cmd/goimports golang.org/x/tools
1313
ls -al
1414
```
1515
```text
16-
-rwxr-xr-x 1 root root 4164448 Nov 24 16:38 goimports-darwin-10.6-386
17-
-rwxr-xr-x 1 root root 5223584 Nov 24 16:38 goimports-darwin-10.6-amd64
16+
-rwxr-xr-x 1 root root 4164448 Nov 24 16:38 goimports-darwin-386
17+
-rwxr-xr-x 1 root root 5223584 Nov 24 16:38 goimports-darwin-amd64
1818
-rwxr-xr-x 1 root root 4217184 Nov 24 16:38 goimports-linux-386
1919
-rwxr-xr-x 1 root root 5295768 Nov 24 16:38 goimports-linux-amd64
2020
-rwxr-xr-x 1 root root 4233120 Nov 24 16:38 goimports-linux-arm
21-
-rwxr-xr-x 1 root root 4373504 Nov 24 16:38 goimports-windows-4.0-386.exe
22-
-rwxr-xr-x 1 root root 5450240 Nov 24 16:38 goimports-windows-4.0-amd64.exe
21+
-rwxr-xr-x 1 root root 4373504 Nov 24 16:38 goimports-windows-386.exe
22+
-rwxr-xr-x 1 root root 5450240 Nov 24 16:38 goimports-windows-amd64.exe
2323
```
2424

2525
This argument may at some point be integrated into the import path itself, but for

doc/usage/platform-versions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ versions of the same operating system. This however can lead to issues if a used
66
dependency is only supported by more recent systems. As such, `xgo` supports the
77
selection of specific platform versions by appending them to the OS target string.
88

9-
* `--targets=darwin-10.9/*`: cross compile to Mac OS X Mavericks
9+
* `--targets=darwin-11.3/*`: cross compile to Mac OS X Mavericks
1010
* `--targets=windows-6.0/*`: cross compile to Windows Vista
1111

1212
The supported platforms are:
1313

1414
* All Windows APIs up to Windows 8.1 limited by `mingw-w64` ([API level ids](https://en.wikipedia.org/wiki/Windows_NT#Releases))
15-
* OSX APIs in the range of 10.6 - 10.11
15+
* OSX APIs in the range of 10.6 - 11.3

rootfs/usr/local/bin/xgo-build

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,10 @@ for TARGET in $TARGETS; do
419419
if [ $XGOOS == "." ] || [[ $XGOOS == windows* ]]; then
420420
# Split the platform version and configure the Windows NT version
421421
PLATFORM=$(echo $XGOOS | cut -d '-' -f 2)
422+
PLATFORM_SUFFIX="-$PLATFORM"
422423
if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "windows" ]; then
423424
PLATFORM=$WINDOWS_DEFAULT_TARGET
425+
PLATFORM_SUFFIX=""
424426
fi
425427

426428
MAJOR=$(echo $PLATFORM | cut -d '.' -f 1)
@@ -431,50 +433,52 @@ for TARGET in $TARGETS; do
431433

432434
# Build the requested windows binaries
433435
if [ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]; then
434-
echo "Compiling for windows-$PLATFORM/amd64..."
436+
echo "Compiling for windows$PLATFORM_SUFFIX/amd64..."
435437
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ HOST=x86_64-w64-mingw32 PREFIX=/usr/x86_64-w64-mingw32 xgo-build-deps /deps ${DEPS_ARGS[@]}
436438
export PKG_CONFIG_PATH=/usr/x86_64-w64-mingw32/lib/pkgconfig
437439

438440
if [[ "$USEMODULES" == false ]]; then
439441
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go get $V $X $TP $VCS "${T[@]}" --ldflags="$V $LD" -d $PACK_RELPATH
440442
fi
441443
ext=$(extension windows)
442-
(set -x ; CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$V $LD" $R $BM -o "/build/$NAME-windows-$PLATFORM-amd64$R$ext" $PACK_RELPATH)
444+
(set -x ; CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$V $LD" $R $BM -o "/build/$NAME-windows-amd64$R$ext" $PACK_RELPATH)
443445
fi
444446
if [ $XGOARCH == "." ] || [ $XGOARCH == "386" ]; then
445-
echo "Compiling for windows-$PLATFORM/386..."
447+
echo "Compiling for windows$PLATFORM_SUFFIX/386..."
446448
CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ HOST=i686-w64-mingw32 PREFIX=/usr/i686-w64-mingw32 xgo-build-deps /deps ${DEPS_ARGS[@]}
447449
export PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig
448450

449451
if [[ "$USEMODULES" == false ]]; then
450452
CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go get $V $X $TP $VCS "${T[@]}" --ldflags="$V $LD" -d $PACK_RELPATH
451453
fi
452454
ext=$(extension windows)
453-
(set -x ; CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-windows-$PLATFORM-386$ext" $PACK_RELPATH)
455+
(set -x ; CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-windows-386$ext" $PACK_RELPATH)
454456
fi
455457
# FIXME: gcc_libinit_windows.c:8:10: fatal error: 'windows.h' file not found
456458
# if [ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ]; then
457459
# if [ "$(semver compare "$GO_VERSION" "1.17.0")" -lt 0 ]; then
458-
# echo "Go version too low, skipping windows-$PLATFORM/arm64..."
460+
# echo "Go version too low, skipping windows$PLATFORM_SUFFIX/arm64..."
459461
# else
460-
# echo "Compiling for windows-$PLATFORM/arm64..."
462+
# echo "Compiling for windows$PLATFORM_SUFFIX/arm64..."
461463
# CC=aarch64-w64-mingw32-gcc CXX=aarch64-w64-mingw32-g++ HOST=aarch64-w64-mingw32 PREFIX=/usr/aarch64-w64-mingw32 xgo-build-deps /deps ${DEPS_ARGS[@]}
462464
# export PKG_CONFIG_PATH=/usr/aarch64-w64-mingw32/lib/pkgconfig
463465
#
464466
# if [[ "$USEMODULES" == false ]]; then
465467
# CC=aarch64-w64-mingw32-gcc CXX=aarch64-w64-mingw32-g++ GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go get $V $X $TP $VCS "${T[@]}" --ldflags="$V $LD" -d $PACK_RELPATH
466468
# fi
467469
# ext=$(extension windows)
468-
# (set -x ; CC=aarch64-w64-mingw32-gcc CXX=aarch64-w64-mingw32-gcc GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-windows-$PLATFORM-386$ext" $PACK_RELPATH)
470+
# (set -x ; CC=aarch64-w64-mingw32-gcc CXX=aarch64-w64-mingw32-gcc GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-windows-386$ext" $PACK_RELPATH)
469471
# fi
470472
# fi
471473
fi
472474
# Check and build for OSX targets
473475
if [ $XGOOS == "." ] || [[ $XGOOS == darwin* ]]; then
474476
# Split the platform version and configure the deployment target
475477
PLATFORM=$(echo $XGOOS | cut -d '-' -f 2)
478+
PLATFORM_SUFFIX="-$PLATFORM"
476479
if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "darwin" ]; then
477480
PLATFORM=$DARWIN_DEFAULT_TARGET
481+
PLATFORM_SUFFIX=""
478482
fi
479483
export MACOSX_DEPLOYMENT_TARGET=$PLATFORM
480484

@@ -485,38 +489,38 @@ for TARGET in $TARGETS; do
485489
fi
486490
# Build the requested darwin binaries
487491
if [ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]; then
488-
echo "Compiling for darwin-$PLATFORM/amd64..."
492+
echo "Compiling for darwin$PLATFORM_SUFFIX/amd64..."
489493
CC=o64-clang CXX=o64-clang++ HOST=x86_64-apple-darwin15 PREFIX=/usr/local xgo-build-deps /deps ${DEPS_ARGS[@]}
490494
if [[ "$USEMODULES" == false ]]; then
491495
CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get $V $X $TP $VCS "${T[@]}" --ldflags="$LDSTRIP $V $LD" -d $PACK_RELPATH
492496
fi
493497
ext=$(extension darwin)
494-
(set -x ; CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$LDSTRIP $V $LD" $R $BM -o "/build/$NAME-darwin-$PLATFORM-amd64$R$ext" $PACK_RELPATH)
498+
(set -x ; CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$LDSTRIP $V $LD" $R $BM -o "/build/$NAME-darwin-amd64$R$ext" $PACK_RELPATH)
495499
fi
496500
if [ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ]; then
497501
if [ "$(semver compare "$GO_VERSION" "1.16.0")" -lt 0 ]; then
498-
echo "Go version too low, skipping darwin-$PLATFORM/arm64..."
502+
echo "Go version too low, skipping darwin/arm64..."
499503
else
500-
echo "Compiling for darwin-$PLATFORM/arm64..."
504+
echo "Compiling for darwin$PLATFORM_SUFFIX/arm64..."
501505
CC=o64-clang CXX=o64-clang++ HOST=arm64-apple-darwin15 PREFIX=/usr/local xgo-build-deps /deps ${DEPS_ARGS[@]}
502506
if [[ "$USEMODULES" == false ]]; then
503507
CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go get $V $X $TP $VCS "${T[@]}" --ldflags="$LDSTRIP $V $LD" -d $PACK_RELPATH
504508
fi
505509
ext=$(extension darwin)
506-
(set -x ; CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build $V $X $TP $VCS $TP $MOD "${T[@]}" --ldflags="$LDSTRIP $V $LD" $R $BM -o "/build/$NAME-darwin-$PLATFORM-arm64$R$ext" $PACK_RELPATH)
510+
(set -x ; CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build $V $X $TP $VCS $TP $MOD "${T[@]}" --ldflags="$LDSTRIP $V $LD" $R $BM -o "/build/$NAME-darwin-arm64$R$ext" $PACK_RELPATH)
507511
fi
508512
fi
509513
if [ $XGOARCH == "." ] || [ $XGOARCH == "386" ]; then
510514
if [ "$(semver compare "$GO_VERSION" "1.15.0")" -lt 0 ]; then
511-
echo "Compiling for darwin-$PLATFORM/386..."
515+
echo "Compiling for darwin$PLATFORM_SUFFIX/386..."
512516
CC=o32-clang CXX=o32-clang++ HOST=i386-apple-darwin15 PREFIX=/usr/local xgo-build-deps /deps ${DEPS_ARGS[@]}
513517
if [[ "$USEMODULES" == false ]]; then
514518
CC=o32-clang CXX=o32-clang++ GOOS=darwin GOARCH=386 CGO_ENABLED=1 go get $V $X $TP $VCS "${T[@]}" --ldflags="$LDSTRIP $V $LD" -d $PACK_RELPATH
515519
fi
516520
ext=$(extension darwin)
517-
(set -x ; CC=o32-clang CXX=o32-clang++ GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-darwin-$PLATFORM-386$ext" $PACK_RELPATH)
521+
(set -x ; CC=o32-clang CXX=o32-clang++ GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build $V $X $TP $VCS $MOD "${T[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-darwin-386$ext" $PACK_RELPATH)
518522
else
519-
echo "Go version too high, skipping darwin-$PLATFORM/386..."
523+
echo "Go version too high, skipping darwin$PLATFORM_SUFFIX/386..."
520524
fi
521525
fi
522526
# Remove any automatically injected deployment target vars

0 commit comments

Comments
 (0)