Skip to content

Commit

Permalink
added support for powershell on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamon Terrell committed Dec 9, 2024
1 parent 24eddee commit dd396d4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ Windows
from existing CMD prompt:
<extracted_location>\oss-cad-suite\environment.bat
from existing PowerShell prompt:
. <extracted_location>\oss-cad-suite\environment.ps1
to create new CMD prompt:
<extracted_location>\oss-cad-suite\start.bat
```
Expand Down
26 changes: 26 additions & 0 deletions default/patches/environment.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Find root dir
if (-not $env:YOSYSHQ_ROOT) {
$env:YOSYSHQ_ROOT = Join-Path (Get-Item -Path $PSScriptRoot).FullName "\"
}

# Set prompt
function Prompt {
"[___BRANDING___] PS " + $(Get-Location) + "> "
}

# Set environment variables
$env:SSL_CERT_FILE = Join-Path $env:YOSYSHQ_ROOT "etc\cacert.pem"
$env:PATH = "$($env:YOSYSHQ_ROOT)bin;$($env:YOSYSHQ_ROOT)lib;$env:PATH"
$env:PYTHON_EXECUTABLE = Join-Path $env:YOSYSHQ_ROOT "lib\python3.exe"
$env:QT_PLUGIN_PATH = Join-Path $env:YOSYSHQ_ROOT "lib\qt5\plugins"
$env:QT_LOGGING_RULES = "*=false"
$env:GTK_EXE_PREFIX = $env:YOSYSHQ_ROOT
$env:GTK_DATA_PREFIX = $env:YOSYSHQ_ROOT
$env:GDK_PIXBUF_MODULEDIR = Join-Path $env:YOSYSHQ_ROOT "lib\gdk-pixbuf-2.0\2.10.0\loaders"
$env:GDK_PIXBUF_MODULE_FILE = Join-Path $env:YOSYSHQ_ROOT "lib\gdk-pixbuf-2.0\2.10.0\loaders.cache"

# Update GDK pixbuf loaders cache
& "$env:YOSYSHQ_ROOT\lib\gdk-pixbuf-query-loaders.exe" --update-cache

# Additional environment variable
$env:OPENFPGALOADER_SOJ_DIR = Join-Path $env:YOSYSHQ_ROOT "share\openFPGALoader"
2 changes: 1 addition & 1 deletion default/rules/resources-min.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
Target(
name = 'system-resources-min',
sources = [ ],
patches = [ 'fonts.conf.template', 'win-launcher.c', 'environment', 'environment.bat', 'start.bat', 'cacert.pem', 'tabbyadm' ],
patches = [ 'fonts.conf.template', 'win-launcher.c', 'environment', 'environment.bat', 'environment.ps1', 'start.bat', 'cacert.pem', 'tabbyadm' ],
tools = {},
)
4 changes: 2 additions & 2 deletions default/rules/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Target(
name = 'system-resources',
sources = [ ],
patches = [ 'fonts.conf.template', 'win-launcher.c', 'environment', 'environment.fish', 'environment.bat', 'start.bat', 'cacert.pem', 'tabbyadm' ],
patches = [ 'fonts.conf.template', 'win-launcher.c', 'environment', 'environment.fish', 'environment.bat', 'environment.ps1', 'start.bat', 'cacert.pem', 'tabbyadm' ],
tools = {},
)

Target(
name = 'system-resources-tabby',
sources = [ ],
patches = [ 'fonts.conf.template', 'win-launcher.c', 'environment', 'environment.bat', 'start.bat', 'cacert.pem', 'tabbyadm' ],
patches = [ 'fonts.conf.template', 'win-launcher.c', 'environment', 'environment.bat', 'environment.ps1', 'start.bat', 'cacert.pem', 'tabbyadm' ],
tools = {},
)
1 change: 1 addition & 0 deletions default/scripts/system-resources-min.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if [ ${ARCH_BASE} == 'windows' ]; then
${CC} -DGUI=0 -O -s -o ${OUTPUT_DIR}${INSTALL_PREFIX}/win-launcher.exe ${PATCHES_DIR}/win-launcher.c

cp ${PATCHES_DIR}/environment.bat ${OUTPUT_DIR}${INSTALL_PREFIX}/.
cp ${PATCHES_DIR}/environment.ps1 ${OUTPUT_DIR}${INSTALL_PREFIX}/.
cp ${PATCHES_DIR}/start.bat ${OUTPUT_DIR}${INSTALL_PREFIX}/.

mkdir -p ${OUTPUT_DIR}${INSTALL_PREFIX}/etc
Expand Down
1 change: 1 addition & 0 deletions default/scripts/system-resources-tabby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ if [ ${ARCH_BASE} == 'windows' ]; then
${CC} -DGUI=0 -O -s -o ${OUTPUT_DIR}${INSTALL_PREFIX}/win-launcher.exe ${PATCHES_DIR}/win-launcher.c

cp ${PATCHES_DIR}/environment.bat ${OUTPUT_DIR}${INSTALL_PREFIX}/.
cp ${PATCHES_DIR}/environment.ps1 ${OUTPUT_DIR}${INSTALL_PREFIX}/.
cp ${PATCHES_DIR}/start.bat ${OUTPUT_DIR}${INSTALL_PREFIX}/.

mkdir -p ${OUTPUT_DIR}${INSTALL_PREFIX}/etc
Expand Down
2 changes: 2 additions & 0 deletions scripts/package-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ rm -rf ${OUTPUT_DIR}${INSTALL_PREFIX}/lib/yosys

cp ${PATCHES_DIR}/${README} ${OUTPUT_DIR}${INSTALL_PREFIX}/README
sed "s|___BRANDING___|${BRANDING}|g" -i ${OUTPUT_DIR}${INSTALL_PREFIX}/environment.bat
sed "s|___BRANDING___|${BRANDING}|g" -i ${OUTPUT_DIR}${INSTALL_PREFIX}/environment.ps1

if [ -f "${OUTPUT_DIR}${INSTALL_PREFIX}/bin/tabbyadm" ]; then
sed "s|___BRANDING___|${BRANDING}|g" -i ${OUTPUT_DIR}${INSTALL_PREFIX}/bin/tabbyadm
fi
Expand Down

0 comments on commit dd396d4

Please sign in to comment.