Merge pull request #407 from nhooyr/windows-d6fa
release: On windows use .exe and alter README
This commit is contained in:
commit
3a3b3389ed
4 changed files with 63 additions and 14 deletions
|
|
@ -4,19 +4,23 @@ cd -- "$(dirname "$0")/../.."
|
|||
. ./ci/sub/lib.sh
|
||||
|
||||
sh_c mkdir -p "$HW_BUILD_DIR"
|
||||
sh_c rsync --recursive --perms --delete \
|
||||
--human-readable --copy-links ./ci/release/template/ "$HW_BUILD_DIR/"
|
||||
VERSION=$VERSION sh_c eval "'$HW_BUILD_DIR/README.md.sh'" \> "'$HW_BUILD_DIR/README.md'"
|
||||
sh_c rm -f "$HW_BUILD_DIR/README.md.sh"
|
||||
sh_c find "$HW_BUILD_DIR" -exec touch {} \\\;
|
||||
sh_c cp ./ci/release/template/LICENSE.txt "$HW_BUILD_DIR"
|
||||
sh_c cp ./ci/release/template/Makefile "$HW_BUILD_DIR"
|
||||
sh_c cp -R ./ci/release/template/man "$HW_BUILD_DIR"
|
||||
sh_c cp -Rf ./ci/release/template/scripts "$HW_BUILD_DIR"
|
||||
sh_c VERSION="$VERSION" ./ci/release/template/README.md.sh \> "'$HW_BUILD_DIR/README.md'"
|
||||
|
||||
ensure_goos
|
||||
ensure_goarch
|
||||
sh_c mkdir -p "$HW_BUILD_DIR/bin"
|
||||
sh_c CGO_ENABLED=0 go build -trimpath \
|
||||
sh_c GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=0 go build -trimpath \
|
||||
-ldflags "'-X oss.terrastruct.com/d2/lib/version.Version=$VERSION'" \
|
||||
-o "$HW_BUILD_DIR/bin/d2" .
|
||||
|
||||
if [ "$GOOS" = windows ]; then
|
||||
sh_c mv "$HW_BUILD_DIR/bin/d2" "$HW_BUILD_DIR/bin/d2.exe"
|
||||
fi
|
||||
|
||||
ARCHIVE=$PWD/$ARCHIVE
|
||||
cd "$(dirname "$HW_BUILD_DIR")"
|
||||
sh_c tar -czf "$ARCHIVE" "$(basename "$HW_BUILD_DIR")"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#### Improvements 🧹
|
||||
|
||||
- The Windows release binary is now suffixed correctly with `.exe` [#388](https://github.com/terrastruct/d2/issues/388)
|
||||
|
||||
#### Bugfixes ⛑️
|
||||
|
||||
- Fixed sequence diagram span size for self-edges [#397](https://github.com/terrastruct/d2/pull/397)
|
||||
- Fixed sequence diagram span size for self-edges [#397](https://github.com/terrastruct/d2/pull/397)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
cd -- "$(dirname "$0")/../../.."
|
||||
. ./ci/sub/lib.sh
|
||||
|
||||
cat <<EOF
|
||||
# d2
|
||||
|
|
@ -7,6 +9,42 @@ cat <<EOF
|
|||
For docs, more installation options and the source code see https://oss.terrastruct.com/d2
|
||||
|
||||
version: $VERSION
|
||||
os: $OS
|
||||
arch: $ARCH
|
||||
|
||||
Built with $(go version | grep -o 'go[^ ]\+').
|
||||
EOF
|
||||
|
||||
ensure_os
|
||||
if [ "$OS" = windows ]; then
|
||||
cat <<EOF
|
||||
|
||||
We currently do not have an \`.msi\` for automatic installation on Windows so this release
|
||||
is structured the same as our Unix releases.
|
||||
|
||||
Easiest way to use d2 on Windows is to just \`chdir\` into the bin directory of this release
|
||||
and invoke d2 like \`./d2 <full-input-file-path>\`
|
||||
|
||||
For installation you'll have to add the \`./bin/d2.exe\` binary to your \`\$PATH\`. Or add
|
||||
the \`./bin\` directory of this release to your \`\$PATH\`.
|
||||
|
||||
See https://www.wikihow.com/Change-the-PATH-Environment-Variable-on-Windows
|
||||
|
||||
Then you'll be able to call \`d2\` from the commandline in \`cmd.exe\` or \`pwsh.exe\`.
|
||||
|
||||
We intend to have a \`.msi\` release installer sometime soon that handles putting \`d2\` into
|
||||
your \`\$PATH\` for you.
|
||||
|
||||
You can also use \`make install\` to install on Windows after first installing
|
||||
[MSYS2](https://www.msys2.org/) which emulates a Linux shell for Windows. Its terminal
|
||||
also enables d2 to show colors in its output. The manpage will also become accessible
|
||||
with \`man d2\`.
|
||||
|
||||
See https://github.com/terrastruct/d2/blob/master/docs/INSTALL.md#windows
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
|
||||
## Install
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ go install oss.terrastruct.com/d2@latest
|
|||
|
||||
### Source Release
|
||||
|
||||
To install a proper release from source clone the repository and then:
|
||||
To install a release from source clone the repository and then:
|
||||
|
||||
```sh
|
||||
./ci/release/build.sh --install
|
||||
|
|
@ -148,17 +148,22 @@ To install a proper release from source clone the repository and then:
|
|||
```
|
||||
|
||||
Installing a real release will also install manpages and in the future other assets like
|
||||
fonts and icons. Furthermore, when installing a non versioned commit, installing a proper
|
||||
release will ensure that `d2 --version` works correctly by embedding the commit hash into
|
||||
the `d2` binary.
|
||||
fonts and icons. Furthermore, when installing a non versioned commit, installing a release
|
||||
will ensure that `d2 --version` works correctly by embedding the commit hash into the `d2`
|
||||
binary.
|
||||
|
||||
## Windows
|
||||
|
||||
d2 builds and runs on Windows:
|
||||
|
||||
We have prebuilt standalone releases for Windows though they're structured in the same way
|
||||
as our Unix releases. So after extracting a release, you'll have to manually put the d2
|
||||
binary into your `$PATH` or add the `bin` directory of the release into your `$PATH`.
|
||||
as our Unix releases.
|
||||
|
||||
Easiest way to use d2 on Windows is to just `chdir` into the bin directory of the release
|
||||
and invoke d2 like `./d2 <full-input-file-path>`
|
||||
|
||||
For installation, you'll have to put the `bin/d2.exe` binary into your `$PATH` or add the
|
||||
`bin` directory of the release into your `$PATH`.
|
||||
|
||||
See https://www.wikihow.com/Change-the-PATH-Environment-Variable-on-Windows
|
||||
|
||||
|
|
@ -176,7 +181,7 @@ Bash](https://gitforwindows.org/#bash) (Git Bash is based on MSYS2) for an impro
|
|||
terminal experience.
|
||||
|
||||
MSYS2 provides a unix style shell environment that is native to Windows (unlike
|
||||
[Cygwin](https://www.cygwin.com/)). MSYS2 allows `install.sh` to work, enables proper
|
||||
[Cygwin](https://www.cygwin.com/)). MSYS2 allows `install.sh` to work, enables automatic
|
||||
installation of our standalone releases via `make install` and makes the manpage
|
||||
accessible via `man d2`.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue