File ffmpeg_get_dlopen_headers.sh of Package A_tw-ffmpeg-7

43
 
1
#!/bin/bash
2
3
# Script to grab headers from existing packages to support dlopen() codec libraries
4
# Requires: bash, coreutils, curl, bsdtar, dnf, dnf-plugins-core, tar, xz
5
# Author: Neal Gompa <ngompa@fedoraproject.org>
6
#
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
echo "Setting up..."
21
# Get local directory
22
LOCALDIR=$(realpath $(dirname $0))
23
24
# Create working area
25
TMPDIR=$(mktemp -d /tmp/mmheadersXXXXXX)
26
mkdir -pv $TMPDIR
27
28
echo "Fetching headers..."
29
# Get OpenH264 headers
30
OPENH264_DEVEL=$(dnf -q download --url 'pkgconfig(openh264)')
31
curl -L $OPENH264_DEVEL | bsdtar -xvf - --include "./usr/include/*" -C $TMPDIR
32
33
echo "Generating tarball..."
34
# Prep tarball tree
35
mv -v ${TMPDIR}/usr ${TMPDIR}/ffdlopenhdrs
36
# Generate tarball
37
tar --transform "s|^${TMPDIR#?}/||" -cJvf ${LOCALDIR}/ffmpeg-dlopen-headers.tar.xz ${TMPDIR}/ffdlopenhdrs
38
# Clean up
39
echo "Cleaning up..."
40
rm -rfv ${TMPDIR}
41
42
echo "Tarball created: ${LOCALDIR}/ffmpeg-dlopen-headers.tar.xz"
43