-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
to replace baked-in paths with relative ones
- Loading branch information
1 parent
e520639
commit 64dcc99
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Patches any yosys-config scripts to replace the fixed build path with a relative one | ||
# Inspired by https://github.com/YosysHQ/oss-cad-suite-build/blob/f41b9ae59c6afe323b41a069da48c3835f0846b0/scripts/package-linux.sh#L248 | ||
|
||
search_path="${1:-.}" | ||
|
||
for yosysconfig in $(find "$search_path" -type f -name yosys-config); do | ||
echo "Fixing paths in" "$yosysconfig" | ||
|
||
patch -ns "$yosysconfig" << EOT | ||
1a2 | ||
> install_prefix="\$(readlink -f "\$(dirname "\${BASH_SOURCE[0]}")/..")" | ||
EOT | ||
|
||
# Get current fixed prefix that is already in the file | ||
old_prefix="$(readlink -f "$(dirname "$yosysconfig")/..")" | ||
|
||
sed -i "s,\"$old_prefix,\"\$install_prefix,g" "$yosysconfig" | ||
sed -i "s,'$old_prefix,\"\$install_prefix\"',g" "$yosysconfig" | ||
sed -i "s,$old_prefix,\"\$install_prefix\",g" "$yosysconfig" | ||
|
||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters