Skip to content

Commit

Permalink
scripts: tweak windows detection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mtzguido committed Jan 11, 2025
1 parent 41ceb79 commit d57a0c6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
12 changes: 8 additions & 4 deletions .scripts/bin-install.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#!/bin/bash

# This is called by the Makefile *after* an installation into the
# prefix, so we add the rest of the files that go into a binary pacakge.
# prefix, so we add the rest of the files that go into a binary package.

set -eu

windows () {
[ -v OS ] && [ "$OS" = "Windows_NT" ]
# This seems portable enough and does not trigger an
# undefined variable error (see set -u above) if $OS
# is unset (like in linux/mac). Note: OSX's bash is usually
# old and does not support '[ -v OS ]'.
[[ "${OS:-}" = "Windows_NT" ]]
}

if [ $# -ne 1 ]; then
echo "Usage: $0 <prefix>" >&2
exit 1
echo "Usage: $0 <prefix>" >&2
exit 1
fi

PREFIX="$1"
Expand Down
7 changes: 5 additions & 2 deletions .scripts/make_fstar_version.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/env bash

windows () {
[[ "${OS:-}" = "Windows_NT" ]]
}

if [[ -z "$FSTAR_VERSION" ]]; then
FSTAR_VERSION=$(head -n 1 version.txt)~dev
fi

if [ "$OS" = "Windows_NT" ]
then
if windows; then
if [ "$PROCESSOR_ARCHITECTURE" = "AMD64" ]
then
PLATFORM="Windows_x64"
Expand Down
6 changes: 5 additions & 1 deletion .scripts/mk-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ PREFIX="$1"
ARCHIVE="$2"

windows () {
[ -v OS ] && [ "$OS" = "Windows_NT" ]
# This seems portable enough and does not trigger an
# undefined variable error (see set -u above) if $OS
# is unset (like in linux/mac). Note: OSX's bash is usually
# old and does not support '[ -v OS ]'.
[[ "${OS:-}" = "Windows_NT" ]]
}

# Computes a (hopefully) sensible default for the current system
Expand Down

0 comments on commit d57a0c6

Please sign in to comment.