a684f95
#!/bin/bash
a684f95
# Copyright 2015-2017 Kevin Kofler <Kevin@tigcc.ticalc.org>
a684f95
# Permission is hereby granted, free of charge, to any person obtaining
a684f95
# a copy of this software and associated documentation files (the
a684f95
# "Software"), to deal in the Software without restriction, including
a684f95
# without limitation the rights to use, copy, modify, merge, publish,
a684f95
# distribute, sublicense, and/or sell copies of the Software, and to
a684f95
# permit persons to whom the Software is furnished to do so, subject to
a684f95
# the following conditions:
a684f95
#
a684f95
# The above copyright notice and this permission notice shall be included
a684f95
# in all copies or substantial portions of the Software.
a684f95
#
a684f95
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
a684f95
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
a684f95
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
a684f95
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
a684f95
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
a684f95
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
a684f95
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
a684f95
a684f95
if [ -z "$1" ] ; then
a684f95
  echo "usage: ./clean_qtwebengine.sh VERSION"
b69eb44
  echo "e.g.: ./clean_qtwebengine.sh 6.5.0"
a684f95
  exit 1
a684f95
fi
a684f95
a684f95
DIRNAME="qtwebengine-everywhere-src-$1"
a684f95
a684f95
echo "removing $DIRNAME"
a684f95
rm -rf "$DIRNAME" || exit $?
a684f95
a684f95
if [ -f "$DIRNAME.tar.xz" ] ; then
a684f95
  echo "unpacking $DIRNAME.tar.xz"
a684f95
  XZ_OPT="-T 4" tar xJf "$DIRNAME.tar.xz" || exit $?
a684f95
elif [ -f "$DIRNAME.tar.bz2" ] ; then
a684f95
  echo "unpacking $DIRNAME.tar.bz2"
a684f95
  tar xjf "$DIRNAME.tar.bz2" || exit $?
a684f95
elif [ -f "$DIRNAME.tar.gz" ] ; then
a684f95
  echo "unpacking $DIRNAME.tar.gz"
a684f95
  tar xzf "$DIRNAME.tar.gz" || exit $?
a684f95
elif [ -f "$DIRNAME.7z" ] ; then
a684f95
  echo "unpacking $DIRNAME.7z"
a684f95
  if type 7za >/dev/null 2>/dev/null ; then
a684f95
    7za x "$DIRNAME.7z" || exit $?
a684f95
  elif type 7z >/dev/null 2>/dev/null ; then
a684f95
    7z x "$DIRNAME.7z" || exit $?
a684f95
  else
a684f95
    echo "error: p7zip required"
a684f95
    exit 1
a684f95
  fi
a684f95
else
a684f95
  echo "error: no archive for $DIRNAME found"
a684f95
  exit 1
a684f95
fi
a684f95
a684f95
echo "running clean_ffmpeg.sh"
a684f95
./clean_ffmpeg.sh "$DIRNAME/src/3rdparty/chromium" || exit $?
a684f95
a684f95
echo "ripping out openh264 sources, keeping just header files"
a684f95
find "$DIRNAME/src/3rdparty/chromium/third_party/openh264/src" -type f -not -name '*.h' -delete || exit $?
a684f95
a684f95
echo "repacking as $DIRNAME-clean.tar.xz"
a684f95
XZ_OPT="-8 -T 2" tar cJf "$DIRNAME-clean.tar.xz" "$DIRNAME" || exit $?
a684f95
a684f95
echo "removing $DIRNAME"
a684f95
rm -rf "$DIRNAME" || exit $?
a684f95
a684f95
echo "done"
a684f95
exit 0