build.plat,vendor: start build.sh
with #!/bin/sh
.
The build scripts generated by Amaranth are designed to be invoked by directly running them with any shell (some of them will re-invoke themselves with `bash` specifically, when it's a toolchain requirement), and they're not currently marked executable, so there's no shebang. Add a shebang line to improve compatibility with cases where they are treated as executables in their own right.
This commit is contained in:
parent
0849e1af0b
commit
5d9ad62f36
|
@ -276,6 +276,7 @@ class TemplatedPlatform(Platform):
|
||||||
|
|
||||||
build_script_templates = {
|
build_script_templates = {
|
||||||
"build_{{name}}.sh": """
|
"build_{{name}}.sh": """
|
||||||
|
#!/bin/sh
|
||||||
# {{autogenerated}}
|
# {{autogenerated}}
|
||||||
set -e{{verbose("x")}}
|
set -e{{verbose("x")}}
|
||||||
{% for var in platform._all_toolchain_env_vars %}
|
{% for var in platform._all_toolchain_env_vars %}
|
||||||
|
|
|
@ -80,6 +80,7 @@ class IntelPlatform(TemplatedPlatform):
|
||||||
quartus_file_templates = {
|
quartus_file_templates = {
|
||||||
**TemplatedPlatform.build_script_templates,
|
**TemplatedPlatform.build_script_templates,
|
||||||
"build_{{name}}.sh": r"""
|
"build_{{name}}.sh": r"""
|
||||||
|
#!/bin/sh
|
||||||
# {{autogenerated}}
|
# {{autogenerated}}
|
||||||
{% for var in platform._all_toolchain_env_vars %}
|
{% for var in platform._all_toolchain_env_vars %}
|
||||||
if [ -n "${{var}}" ]; then
|
if [ -n "${{var}}" ]; then
|
||||||
|
|
|
@ -182,6 +182,7 @@ class LatticeECP5Platform(TemplatedPlatform):
|
||||||
_diamond_file_templates = {
|
_diamond_file_templates = {
|
||||||
**TemplatedPlatform.build_script_templates,
|
**TemplatedPlatform.build_script_templates,
|
||||||
"build_{{name}}.sh": r"""
|
"build_{{name}}.sh": r"""
|
||||||
|
#!/bin/sh
|
||||||
# {{autogenerated}}
|
# {{autogenerated}}
|
||||||
set -e{{verbose("x")}}
|
set -e{{verbose("x")}}
|
||||||
if [ -z "$BASH" ] ; then exec /bin/bash "$0" "$@"; fi
|
if [ -z "$BASH" ] ; then exec /bin/bash "$0" "$@"; fi
|
||||||
|
|
|
@ -175,6 +175,7 @@ class LatticeICE40Platform(TemplatedPlatform):
|
||||||
_icecube2_file_templates = {
|
_icecube2_file_templates = {
|
||||||
**TemplatedPlatform.build_script_templates,
|
**TemplatedPlatform.build_script_templates,
|
||||||
"build_{{name}}.sh": r"""
|
"build_{{name}}.sh": r"""
|
||||||
|
#!/bin/sh
|
||||||
# {{autogenerated}}
|
# {{autogenerated}}
|
||||||
set -e{{verbose("x")}}
|
set -e{{verbose("x")}}
|
||||||
{% for var in platform._all_toolchain_env_vars %}
|
{% for var in platform._all_toolchain_env_vars %}
|
||||||
|
|
|
@ -139,6 +139,7 @@ class XilinxPlatform(TemplatedPlatform):
|
||||||
_vivado_file_templates = {
|
_vivado_file_templates = {
|
||||||
**TemplatedPlatform.build_script_templates,
|
**TemplatedPlatform.build_script_templates,
|
||||||
"build_{{name}}.sh": r"""
|
"build_{{name}}.sh": r"""
|
||||||
|
#!/bin/sh
|
||||||
# {{autogenerated}}
|
# {{autogenerated}}
|
||||||
set -e{{verbose("x")}}
|
set -e{{verbose("x")}}
|
||||||
if [ -z "$BASH" ] ; then exec /bin/bash "$0" "$@"; fi
|
if [ -z "$BASH" ] ; then exec /bin/bash "$0" "$@"; fi
|
||||||
|
|
|
@ -35,6 +35,7 @@ Platform integration changes
|
||||||
|
|
||||||
.. currentmodule:: amaranth.vendor
|
.. currentmodule:: amaranth.vendor
|
||||||
|
|
||||||
|
* Added: ``build.sh`` begins with ``#!/bin/sh``.
|
||||||
* Removed: (deprecated in 0.4) :mod:`vendor.intel`, :mod:`vendor.lattice_ecp5`, :mod:`vendor.lattice_ice40`, :mod:`vendor.lattice_machxo2_3l`, :mod:`vendor.quicklogic`, :mod:`vendor.xilinx`. (`RFC 18`_)
|
* Removed: (deprecated in 0.4) :mod:`vendor.intel`, :mod:`vendor.lattice_ecp5`, :mod:`vendor.lattice_ice40`, :mod:`vendor.lattice_machxo2_3l`, :mod:`vendor.quicklogic`, :mod:`vendor.xilinx`. (`RFC 18`_)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue