Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion scripts/package-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# ##################################################################################################

set -euxo pipefail
set -euo pipefail

NONINTERACTIVE=0
while [[ $# -gt 0 ]]; do
case "$1" in
--noninteractive) NONINTERACTIVE=1; shift ;;
*) echo "Unknown argument: $1" >&2; exit 1 ;;
esac
done

# SLASH root
cd "$(dirname "$0")/.."
Expand All @@ -31,6 +39,47 @@ export ARTIFACTS_DIR="${ARTIFACTS_DIR:-"$(pwd)"/deb}"
export DPKG_ARCH="$(dpkg --print-architecture)"
export DPKG_PARSED_VERSION="$(dpkg-parsechangelog -SVersion)"

# Warn before overwriting an existing build
if [[ -d "${ARTIFACTS_DIR}" ]] && [[ -t 0 ]] && [[ "${NONINTERACTIVE}" -eq 0 ]]; then
echo "WARNING: A previous .deb build already exists." >&2
echo "Proceeding will remove the following directories and restart the build from scratch:" >&2
echo " ${ARTIFACTS_DIR} (built .deb packages)" >&2
echo " pbuild/ (CMake build tree)" >&2
echo " debian/ (generated packaging metadata)" >&2
echo " linker/src/install.prj" >&2
echo " linker/resources/abstract_shell" >&2
echo "This includes the static shell, which can take several hours to rebuild." >&2
read -r -p "Overwrite existing build and start from scratch? [y/N] " _answer </dev/tty
case "${_answer}" in
[yY]|[yY][eE][sS]) ;;
*) echo "Aborted." >&2; exit 1 ;;
esac
fi

# Check build prerequisites
_prereq_ok=1

if ! command -v v++ > /dev/null 2>&1; then
echo "ERROR: v++ not found in PATH. Source Vitis 2025.1 before building:" >&2
echo " source <path-to-vitis>/settings64.sh" >&2
echo "See docs/tutorials/admin/platform-setup.rst for details." >&2
_prereq_ok=0
fi

if ! compgen -G 'linker/resources/base/iprepo/smbus*/' > /dev/null 2>&1; then
echo "ERROR: SMBus IP (xilinx.com:ip:smbus:1.1) not found in linker/resources/base/iprepo/." >&2
echo "Download it from https://www.xilinx.com/member/v80.html and place the IP" >&2
echo "directory into linker/resources/base/iprepo/ before building." >&2
echo "See docs/tutorials/admin/platform-setup.rst for details." >&2
_prereq_ok=0
fi

if [[ "${_prereq_ok}" -eq 0 ]]; then
exit 1
fi

set -x

# Clean build
rm -rf deb
mkdir -p deb
Expand Down
53 changes: 51 additions & 2 deletions scripts/package-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# ##################################################################################################

set -euxo pipefail
set -euo pipefail

NONINTERACTIVE=0
while [[ $# -gt 0 ]]; do
case "$1" in
--noninteractive) NONINTERACTIVE=1; shift ;;
*) echo "Unknown argument: $1" >&2; exit 1 ;;
esac
done

# SLASH root
cd "$(dirname "$0")/.."
Expand All @@ -29,7 +37,48 @@ VERSION="$(tr -d '[:space:]' < packaging/version)"
TOPDIR="$(pwd)/rpmbuild"
ARTIFACTS_DIR="${ARTIFACTS_DIR:-$(pwd)/rpm}"

rm -rf "${TOPDIR}" "${ARTIFACTS_DIR}"
# Warn before overwriting an existing build
if [[ -d "${ARTIFACTS_DIR}" ]] && [[ -t 0 ]] && [[ "${NONINTERACTIVE}" -eq 0 ]]; then
echo "WARNING: A previous .rpm build already exists." >&2
echo "Proceeding will remove the following directories and restart the build from scratch:" >&2
[[ -d "${TOPDIR}" ]] && echo " ${TOPDIR} (rpmbuild tree)" >&2
[[ -d "${ARTIFACTS_DIR}" ]] && echo " ${ARTIFACTS_DIR} (built .rpm packages)" >&2
[[ -d pbuild ]] && echo " pbuild/ (CMake build tree)" >&2
echo " linker/src/install.prj" >&2
echo " linker/resources/abstract_shell" >&2
echo "This includes the static shell, which can take several hours to rebuild." >&2
read -r -p "Overwrite existing build and start from scratch? [y/N] " _answer </dev/tty
case "${_answer}" in
[yY]|[yY][eE][sS]) ;;
*) echo "Aborted." >&2; exit 1 ;;
esac
fi

# Check build prerequisites
_prereq_ok=1

if ! command -v v++ > /dev/null 2>&1; then
echo "ERROR: v++ not found in PATH. Source Vitis 2025.1 before building:" >&2
echo " source <path-to-vitis>/settings64.sh" >&2
echo "See docs/tutorials/admin/platform-setup.rst for details." >&2
_prereq_ok=0
fi

if ! compgen -G 'linker/resources/base/iprepo/smbus*/' > /dev/null 2>&1; then
echo "ERROR: SMBus IP (xilinx.com:ip:smbus:1.1) not found in linker/resources/base/iprepo/." >&2
echo "Download it from https://www.xilinx.com/member/v80.html and place the IP" >&2
echo "directory into linker/resources/base/iprepo/ before building." >&2
echo "See docs/tutorials/admin/platform-setup.rst for details." >&2
_prereq_ok=0
fi

if [[ "${_prereq_ok}" -eq 0 ]]; then
exit 1
fi

set -x

rm -rf "${TOPDIR}" "${ARTIFACTS_DIR}" pbuild
mkdir -p "${TOPDIR}"/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
mkdir -p "${ARTIFACTS_DIR}"

Expand Down