|
|
|
@ -18,6 +18,8 @@ |
|
|
|
# arm-unknown-linux-gnueabihf |
|
|
|
# aarch64-unknown-linux-gnu |
|
|
|
|
|
|
|
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" |
|
|
|
|
|
|
|
INFO="$( echo *.info )" |
|
|
|
if [ ! -e "$INFO" ]; then |
|
|
|
echo "No (or multiple) .info file in current dir" 1>&2 |
|
|
|
@ -60,6 +62,9 @@ if [ ! -e "Cargo.toml" ]; then |
|
|
|
elif [ -e "$CWD/Cargo-toml.patch" ]; then |
|
|
|
echo "INFO: Applying Cargo.toml patch" |
|
|
|
patch -Np1 < $CWD/Cargo-toml.patch |
|
|
|
elif [ -e "$CWD/no-git-patch-builds.patch" ]; then |
|
|
|
echo "INFO: Applying no-git-patch-builds.patch patch" |
|
|
|
patch -Np1 < $CWD/no-git-patch-builds.patch |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then |
|
|
|
@ -101,39 +106,46 @@ else |
|
|
|
fi |
|
|
|
|
|
|
|
# Configure cargo-vendor-filterer |
|
|
|
if [ "$(grep -c "^\[package\]$" Cargo.toml)" -eq 1 ]; then |
|
|
|
echo "This is a normal cargo package." |
|
|
|
SRCTYPE="package" |
|
|
|
elif [ "$(grep -c "^\[workspace\]$" Cargo.toml)" -eq 1 ]; then |
|
|
|
echo "This is a cargo workspace." |
|
|
|
SRCTYPE="workspace" |
|
|
|
else |
|
|
|
echo "Cargo.toml does not contain [package] or [workspace], exiting." |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
cat << EOF >> Cargo.toml |
|
|
|
[package.metadata.vendor-filter] |
|
|
|
[$SRCTYPE.metadata.vendor-filter] |
|
|
|
platforms = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabihf"] |
|
|
|
all-features = true |
|
|
|
exclude-crate-paths = [ |
|
|
|
{ name = "openssl-src", exclude = "openssl" }, |
|
|
|
] |
|
|
|
EOF |
|
|
|
|
|
|
|
if [ -f /usr/bin/cargo-vendor-filterer ]; then |
|
|
|
echo "INFO: Creating filtered vendor libs tarball..." |
|
|
|
/usr/bin/cargo-vendor-filterer |
|
|
|
/usr/bin/cargo-vendor-filterer | tee $WORKDIR/tmpconfig.toml |
|
|
|
else |
|
|
|
echo "WARNING: Creating unfiltered vendor libs tarball!" |
|
|
|
cargo vendor |
|
|
|
cargo vendor | tee $WORKDIR/tmpconfig.toml |
|
|
|
fi |
|
|
|
|
|
|
|
# build would fail if the .a files were removed |
|
|
|
#find vendor -type f -a -name \*.a -print0 | xargs -0 rm -f |
|
|
|
|
|
|
|
# add vendored-sources section generated by cargo-vendor-filterer |
|
|
|
mkdir -p .cargo |
|
|
|
cat <<EOF >.cargo/config.toml |
|
|
|
[source.crates-io] |
|
|
|
replace-with = "vendored-sources" |
|
|
|
|
|
|
|
[source.vendored-sources] |
|
|
|
directory = "vendor" |
|
|
|
EOF |
|
|
|
cat $WORKDIR/tmpconfig.toml >> .cargo/config.toml |
|
|
|
cd - |
|
|
|
|
|
|
|
cd $WORKDIR |
|
|
|
tar cvfJ $CWD/$SRCNAM-vendored-sources-$VERSION-$VSBUILD.tar.xz \ |
|
|
|
$SRCNAM-$VERSION/$VSDIR/{vendor,.cargo} |
|
|
|
echo "Creating vendored tar file..." |
|
|
|
tar --totals --checkpoint=100 --checkpoint-action=dot \ |
|
|
|
--sort=name --mtime="@0" --owner=0 --group=0 --numeric-owner \ |
|
|
|
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ |
|
|
|
-cJf $CWD/$SRCNAM-vendored-sources-$VERSION-$VSBUILD.tar.xz \ |
|
|
|
$SRCNAM-$VERSION/$VSDIR/{vendor,.cargo} |
|
|
|
md5sum $CWD/$SRCNAM-vendored-sources-$VERSION-$VSBUILD.tar.xz |
|
|
|
cd $CWD |
|
|
|
rm -rf $WORKDIR |