Files
PowerShell/build.sh
T

28 lines
1.0 KiB
Bash
Raw Normal View History

2015-11-13 13:54:44 -08:00
#!/usr/bin/env bash
2016-02-19 13:56:40 -08:00
# Test for build dependencies
hash cmake 2>/dev/null || { echo >&2 "No cmake, please run 'sudo apt-get install cmake'"; exit 1; }
hash g++ 2>/dev/null || { echo >&2 "No g++, please run 'sudo apt-get install g++'"; exit 1; }
hash dotnet 2>/dev/null || { echo >&2 "No dotnet, please visit https://dotnet.github.io/getting-started/"; exit 1; }
2015-12-16 13:01:21 -08:00
2016-02-19 13:56:40 -08:00
# Test for lock file
test -r src/Microsoft.PowerShell.Linux.Host/project.lock.json || { echo >&2 "Please run 'dotnet restore' to download .NET Core packages"; exit 2; }
# Ensure output directory is made
BIN="$(pwd)/bin"
mkdir -p "$BIN"
# Build native library and deploy to bin
2016-02-10 13:05:46 -08:00
pushd src/libpsl-native
cmake -DCMAKE_BUILD_TYPE=Debug .
make -j
ctest -V
2016-02-19 13:56:40 -08:00
test -r src/libpsl-native.* || { echo >&2 "Compilation of libpsl-native failed"; exit 3; }
cp src/libpsl-native.* "$BIN"
2016-02-10 13:05:46 -08:00
popd
2015-12-16 13:01:21 -08:00
2016-02-19 13:56:40 -08:00
# Publish PowerShell to bin, with LINUX defined through a configuration
dotnet publish --output "$BIN" --configuration Linux src/Microsoft.PowerShell.Linux.Host
# Fix permissions for packaging
chmod -R go=u "$BIN"