Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9ba718f
[AOMP] Add check_writable_installdir helper fn
jtb20 Jan 16, 2025
99a0d43
[AOMP] Add cmquot/shquot helper functions
jtb20 Jan 16, 2025
d3a828c
[AOMP] Factor out writable install dir checks
jtb20 Jan 15, 2025
60bfe60
[AOMP] Use $(...) instead of backtick syntax
jtb20 Jan 15, 2025
7f9426c
[AOMP] Rework FileCheck-finding logic to avoid parsing ls output
jtb20 Jan 17, 2025
1d7c1d1
[AOMP] AOMP_NINJA_BIN quoting and typo fix
jtb20 Jan 16, 2025
e7aad69
[AOMP] build-deb-aomp.sh shebang line
jtb20 Jan 16, 2025
ddb4723
[AOMP] Fix wrong var for HIPCC_REPO_DIR
jtb20 Feb 26, 2025
fe0aa5d
[AOMP] Remove uninitialised var refs
jtb20 Jan 16, 2025
604684b
[AOMP] Remove unused vars in several scripts
jtb20 Jan 17, 2025
0df3413
[AOMP] Use test -n instead of test ! -z
jtb20 Jan 17, 2025
43d7af1
[AOMP] Use "cd ... || exit" idiom
jtb20 Jan 17, 2025
32ee1cc
[AOMP] Add missing quotation for shell variables
jtb20 Jan 17, 2025
640047b
[AOMP] Safer 'find' invocation in build_aomp.sh
jtb20 Feb 26, 2025
23e7d23
[AOMP] Change quoting for RPATH variables
jtb20 Feb 26, 2025
eb5be0d
[AOMP] Use 'if cmd' directly instead of testing $?
jtb20 Jan 16, 2025
59acbdc
[AOMP] Use arrays for cmake options, etc.
jtb20 May 14, 2025
013dcc6
[AOMP] Group echos in build-deb-aomp.sh
jtb20 Jan 16, 2025
7a0401c
[AOMP] Export 'log' variable in run_omptests.sh
jtb20 Jan 16, 2025
7cc81b8
[AOMP] Avoid parsing ls output in several scripts
jtb20 Jan 16, 2025
4325d42
[AOMP] Remove unneeded cats
jtb20 Feb 24, 2025
67ab7c6
[AOMP] Move some variable initialisations higher up build-rpm.sh
jtb20 Jan 16, 2025
bf0751d
[AOMP] Don't set LDFLAGS in several build scripts
jtb20 Jan 16, 2025
a6767dc
[AOMP] Use fn arg not global for edit_installed_hip_file parameter
jtb20 Jan 16, 2025
92ee4e2
[AOMP] Use regexps instead of cut and eval in several scripts
jtb20 Jan 17, 2025
67c981e
[AOMP] Use -r arg for read to avoid shellcheck complaint
jtb20 Jan 16, 2025
c241117
[AOMP] Quotation fixes for get_trunk_pr_since
jtb20 Jan 16, 2025
05fc219
[AOMP] Split condition in build_libdevice.sh
jtb20 Jan 16, 2025
7338d29
[AOMP] Avoid $? usage and fix quoting and $ in exprs for repeat_fprin…
jtb20 Jan 16, 2025
9ef3102
[AOMP] Fix build_aomp_docker_release.sh array name typo
jtb20 Feb 19, 2025
c54c725
[AOMP] Comment out code accessing 'llvm_dylib' variable
jtb20 Feb 19, 2025
bade808
[AOMP] Add shellcheck annotation
jtb20 Jan 17, 2025
481f5c7
[AOMP] Turn on strict options for running under osh
jtb20 Feb 26, 2025
794d9b3
[AOMP] Split out locating of 'getconf' from if condition
jtb20 Feb 26, 2025
689467a
[AOMP] Initialise 'list' variable
jtb20 Feb 26, 2025
bb6c1f5
[AOMP] SED_INSTALL_DIR quoting tweaks
jtb20 Feb 26, 2025
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
211 changes: 143 additions & 68 deletions bin/aomp_common_vars

Large diffs are not rendered by default.

136 changes: 72 additions & 64 deletions bin/build-deb-aomp.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/bash
#!/bin/bash
#
# build-deb-aomp.sh: Using debhelper and alien, build the aomp debian and rpm packages
# This script is tested on amd64 and ppc64le linux architectures.
Expand All @@ -10,22 +10,22 @@
#

# --- Start standard header to set AOMP environment variables ----
realpath=`realpath $0`
thisdir=`dirname $realpath`
. $thisdir/aomp_common_vars
realpath=$(realpath "$0")
thisdir=$(dirname "$realpath")
. "$thisdir/aomp_common_vars"
# --- end standard header ----

. /etc/lsb-release
RELSTRING=`echo $DISTRIB_ID$DISTRIB_RELEASE | tr -d "."`
echo RELSTRING=$RELSTRING
RELSTRING=$(echo $DISTRIB_ID$DISTRIB_RELEASE | tr -d ".")
echo "RELSTRING=$RELSTRING"

if [ "$1" == aomp-hip-libraries ]; then
pkgname=aomp-hip-libraries
else
pkgname=aomp
fi

echo Building $pkgname package
echo "Building $pkgname package"

dirname="aomp_${AOMP_VERSION_STRING}"
sourcedir="/usr/lib/$dirname"
Expand All @@ -35,7 +35,7 @@ DEBFULLNAME="Greg Rodgers"
DEBEMAIL="Gregory.Rodgers@amd.com"
export DEBFULLNAME DEBEMAIL

DEBARCH=`uname -m`
DEBARCH=$(uname -m)
if [ "$DEBARCH" == "x86_64" ] ; then
DEBARCH="amd64"
fi
Expand All @@ -46,115 +46,123 @@ if [ "$DEBARCH" == "aarch64" ] ; then
DEBARCH="arm64"
fi

tmpdir=/tmp/$USER/build-deb
builddir=$tmpdir/$pkgname
if [ -d $builddir ] ; then
tmpdir="/tmp/$USER/build-deb"
builddir="$tmpdir/$pkgname"
if [ -d "$builddir" ] ; then
echo
echo "--- CLEANUP LAST BUILD: rm -rf $builddir"
sudo rm -rf $builddir
sudo rm -rf "$builddir"
fi

debdir=$PWD/debian
froot=$builddir/$pkgname-$AOMP_VERSION
mkdir -p $froot$installdir
mkdir -p $froot/usr/share/doc/$dirname
froot="$builddir/$pkgname-$AOMP_VERSION"
mkdir -p "$froot$installdir"
mkdir -p "$froot/usr/share/doc/$dirname"
echo
echo "--- PREPARING fake root directory $froot"
sed -i -e "s|//|/|g" $BUILD_DIR/build/rocmlibs/installed_files.txt
sed -i -e "s|//|/|g" "$BUILD_DIR/build/rocmlibs/installed_files.txt"
if [ "$pkgname" == "aomp-hip-libraries" ]; then
cat $BUILD_DIR/build/rocmlibs/installed_files.txt | xargs -I {} cp -d --parents {} $froot
xargs -I {} cp -d --parents {} "$froot" < "$BUILD_DIR/build/rocmlibs/installed_files.txt"
else
# Create a temporary file to exclude math libraries if present
if [ -f $BUILD_DIR/build/rocmlibs/installed_files.txt ]; then
if [ -f "$BUILD_DIR/build/rocmlibs/installed_files.txt" ]; then
tmpfile=/tmp/tmp_installed_files.txt
rm -f $tmpfile
cp $BUILD_DIR/build/rocmlibs/installed_files.txt $tmpfile
sed -i -e "s/\/usr\/lib\/$dirname\///g" $tmpfile
echo "rocblas" >> $tmpfile
echo "lib/rocblas" >> $tmpfile
rm -f "$tmpfile"
cp "$BUILD_DIR/build/rocmlibs/installed_files.txt" "$tmpfile"
sed -i -e "s/\/usr\/lib\/$dirname\///g" "$tmpfile"
echo "rocblas" >> "$tmpfile"
echo "lib/rocblas" >> "$tmpfile"
fi
rsync -a $sourcedir"/" --exclude ".*" --exclude "rocblas" --exclude "rocsparse" --exclude "rocprim" --exclude "hipblas" --exclude "rocsolver" --exclude "hipblas-common" --exclude-from=$tmpfile $froot$installdir
rsync -a "$sourcedir/" --exclude ".*" --exclude "rocblas" --exclude "rocsparse" --exclude "rocprim" --exclude "hipblas" --exclude "rocsolver" --exclude "hipblas-common" --exclude-from="$tmpfile" "$froot$installdir"
fi

if [ "$pkgname" == "aomp-hip-libraries" ]; then
mkdir -p $froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}
cp $debdir/copyright $froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}/.
cp $debdir/LICENSE.TXT $froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}/.
mkdir -p "$froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}"
cp "$debdir/copyright" "$froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}/."
cp "$debdir/LICENSE.TXT" "$froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}/."
else
cp $debdir/copyright $froot/usr/share/doc/$dirname/.
cp $debdir/LICENSE.TXT $froot/usr/share/doc/$dirname/.
cp "$debdir/copyright" "$froot/usr/share/doc/$dirname/."
cp "$debdir/LICENSE.TXT" "$froot/usr/share/doc/$dirname/."
fi

cp -rp $debdir $froot/debian
cp -rp "$debdir" "$froot/debian"
if [ "$DEBARCH" != "amd64" ] ; then
echo sed -i -e"s/amd64/$DEBARCH/" $froot/debian/control
sed -i -e"s/amd64/$DEBARCH/" $froot/debian/control
echo "sed -i -e\"s/amd64/$DEBARCH/\" $froot/debian/control"
sed -i -e"s/amd64/$DEBARCH/" "$froot/debian/control"
fi

if [ "$pkgname" == "aomp-hip-libraries" ]; then
echo sed -i -e"s/Source: aomp/Source: $pkgname/" $froot/debian/control
sed -i -e"s/Source: aomp/Source: $pkgname/" $froot/debian/control
echo sed -i -e"s/Package: aomp/Package: $pkgname/" $froot/debian/control
sed -i -e"s/Package: aomp/Package: $pkgname/" $froot/debian/control
echo "sed -i -e\"s/Source: aomp/Source: $pkgname/\" $froot/debian/control"
sed -i -e"s/Source: aomp/Source: $pkgname/" "$froot/debian/control"
echo "sed -i -e\"s/Package: aomp/Package: $pkgname/\" $froot/debian/control"
sed -i -e"s/Package: aomp/Package: $pkgname/" "$froot/debian/control"
fi

# Make the install and links file version specific
if [ "$pkgname" == "aomp-hip-libraries" ]; then
echo "usr/lib/$dirname" > $froot/debian/$pkgname.install
echo "usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}" >> $froot/debian/$pkgname.install
{
echo "usr/lib/$dirname"
echo "usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}"
} > "$froot/debian/$pkgname.install"
else
echo "usr/lib/$dirname usr/lib/aomp" > $froot/debian/$pkgname.links
echo "usr/lib/$dirname/bin/aompExtractRegion /usr/bin/aompExtractRegion" >> $froot/debian/$pkgname.links
echo "usr/lib/$dirname/bin/cloc.sh /usr/bin/cloc.sh" >> $froot/debian/$pkgname.links
echo "usr/lib/$dirname/bin/mymcpu /usr/bin/mymcpu" >> $froot/debian/$pkgname.links
echo "usr/lib/$dirname/bin/mygpu /usr/bin/mygpu" >> $froot/debian/$pkgname.links
echo "usr/lib/$dirname/bin/aompversion /usr/bin/aompversion" >> $froot/debian/$pkgname.links
echo "usr/lib/$dirname/bin/aompcc /usr/bin/aompcc" >> $froot/debian/$pkgname.links
echo "usr/lib/$dirname/bin/gpurun /usr/bin/gpurun" >> $froot/debian/$pkgname.links
echo "usr/lib/$dirname" > $froot/debian/$pkgname.install
echo "usr/share/doc/$dirname" >> $froot/debian/$pkgname.install
{
echo "usr/lib/$dirname usr/lib/aomp"
echo "usr/lib/$dirname/bin/aompExtractRegion /usr/bin/aompExtractRegion"
echo "usr/lib/$dirname/bin/cloc.sh /usr/bin/cloc.sh"
echo "usr/lib/$dirname/bin/mymcpu /usr/bin/mymcpu"
echo "usr/lib/$dirname/bin/mygpu /usr/bin/mygpu"
echo "usr/lib/$dirname/bin/aompversion /usr/bin/aompversion"
echo "usr/lib/$dirname/bin/aompcc /usr/bin/aompcc"
echo "usr/lib/$dirname/bin/gpurun /usr/bin/gpurun"
} > "$froot/debian/$pkgname.links"
{
echo "usr/lib/$dirname"
echo "usr/share/doc/$dirname"
} > "$froot/debian/$pkgname.install"
fi

echo

echo "--- BUILDING SOURCE TARBALL $builddir/${pkgname}_$AOMP_VERSION.orig.tar.gz "
echo " FROM FAKEROOT: $froot "
cd $builddir
tar -czf $builddir/${pkgname}_$AOMP_VERSION.orig.tar.gz ${pkgname}-$AOMP_VERSION
cd "$builddir" || exit
tar -czf "$builddir/${pkgname}_$AOMP_VERSION.orig.tar.gz" "${pkgname}-$AOMP_VERSION"
echo " DONE BUILDING TARBALL"

echo
echo "--- RUNNING dch TO MANANGE CHANGELOG "
cd $froot
cd "$froot" || exit
# Skip changelog editor for docker release builds.
echo dch -v ${AOMP_VERSION_STRING} -e --package $pkgname
echo "dch -v ${AOMP_VERSION_STRING} -e --package $pkgname"
if [ "$DOCKER" == "1" ]; then
dch -v ${AOMP_VERSION_STRING} --package $pkgname ""
dch -v "${AOMP_VERSION_STRING}" --package "$pkgname" ""
else
dch -v ${AOMP_VERSION_STRING} --package $pkgname
dch -v "${AOMP_VERSION_STRING}" --package "$pkgname"
fi
# Backup the debian changelog to git repo, be sure to commit this
cp -p $froot/debian/changelog $debdir/.
cp -p "$froot/debian/changelog" "$debdir/."

debuildargs="-us -uc -rsudo --lintian-opts -X files,changelog-file,fields"
declare -a debuildargs

debuildargs=(-us -uc -rsudo --lintian-opts -X "files,changelog-file,fields")
echo
echo "--- BUILDING DEB: debuild $debuildargs "
debuild $debuildargs
echo "--- BUILDING DEB: debuild" "${debuildargs[@]}"
debuild "${debuildargs[@]}"
dbrc=$?
echo " DONE BUILDING DEB WITH RC: $dbrc"
if [ "$dbrc" != "0" ] ; then
echo "ERROR during debuild"
exit $dbrc
exit "$dbrc"
fi
# Backup debhelper log to git repo , be sure to commit this
cp -p $froot/debian/${pkgname}.debhelper.log $debdir/.
cp -p "$froot/debian/${pkgname}.debhelper.log" "$debdir/."

mkdir -p $tmpdir/debs
if [ -f $tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb ] ; then
rm -f $tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb
mkdir -p "$tmpdir/debs"
if [ -f "$tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb" ] ; then
rm -f "$tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb"
fi
# Insert the os release name
cp -p $builddir/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb $tmpdir/debs/${pkgname}_${RELSTRING}_${AOMP_VERSION_STRING}_$DEBARCH.deb
cp -p "$builddir/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb" "$tmpdir/debs/${pkgname}_${RELSTRING}_${AOMP_VERSION_STRING}_$DEBARCH.deb"
echo
echo "DONE Debian package is in $tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb"
echo
Loading