aboutsummaryrefslogtreecommitdiff
path: root/libraries/libopenraw/mkvendored.sh
blob: 0d70bc8abd545c74a845a780860e4cc90c96aea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash

# 20211124 bkw: mkvendored.sh, part of libopenraw SBo SlackBuild.
# create libopenraw-vendored-sources-$VERSION-$BUILD.tar.xz
# requires network access, but does not require root privilege.

PRGNAM=libopenraw
CWD=$(pwd)
source ./$PRGNAM.info

set -e
WORKDIR=$( mktemp -d )
cd $WORKDIR

# don't depend on user's ~/.cargo
mkdir -p cargohome
export CARGO_HOME=$(pwd)/cargohome

grep '^BUILD=' $CWD/$PRGNAM.SlackBuild > 1
source ./1

tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION/lib/mp4

for i in . mp4parse mp4parse_capi; do
  cd $i
    cargo vendor
    find vendor -type f -a -name \*.a -print0 | xargs -0 rm -f
	 mkdir -p .cargo
	 cat <<EOF >.cargo/config.toml
[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"
EOF
  cd -
done

cd $WORKDIR
tar cvfJ $CWD/libopenraw-vendored-sources-$VERSION-$BUILD.tar.xz \
         $PRGNAM-$VERSION/lib/mp4/{,mp4parse/,mp4parse_capi/}{vendor,.cargo}
cd $CWD
rm -rf $WORKDIR