mediainfo.SlackBuild 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. #!/bin/bash
  2. # Slackware build script for mediainfo
  3. # Copyright 2010-2012 Binh Nguyen <binhvng@gmail.com>
  4. # Copyright 2012-2017 Ryan P.C. McQuen | Everett, WA | ryanpcmcquen@member.fsf.org
  5. # Copyright 2017-2022 Jeremy Hansen <jebrhansen+SBo -at- gmail.com>
  6. # All rights reserved.
  7. #
  8. # Redistribution and use of this script, with or without modification, is
  9. # permitted provided that the following conditions are met:
  10. #
  11. # 1. Redistributions of this script must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  15. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  17. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  18. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  22. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  23. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=mediainfo
  26. VERSION=${VERSION:-21.09}
  27. SRCNAM=MediaInfo
  28. BUILD=${BUILD:-1}
  29. TAG=${TAG:-_SBo}
  30. PKGTYPE=${PKGTYPE:-tgz}
  31. # CLI is built by default, GUI is optional
  32. CLI=${CLI:-yes}
  33. GUI=${GUI:-no}
  34. # Clear the document variables to make sure it works
  35. CLIDOC=""
  36. GUIDOC=""
  37. # Let's make sure that at least one of the interfaces will be built
  38. if [ "${CLI}" != "yes" ] && [ "${GUI}" != "yes" ]; then
  39. echo -e "\n\n\t=========================================================\n"
  40. echo -e "\tYou must choose either the CLI or GUI (or both) to be built."
  41. echo -e "\n\t=========================================================\n\n"
  42. exit 1
  43. fi
  44. if [ -z "$ARCH" ]; then
  45. case "$( uname -m )" in
  46. i?86) ARCH=i586 ;;
  47. arm*) ARCH=arm ;;
  48. *) ARCH=$( uname -m ) ;;
  49. esac
  50. fi
  51. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  52. # the name of the created package would be, and then exit. This information
  53. # could be useful to other scripts.
  54. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  55. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  56. exit 0
  57. fi
  58. TMP=${TMP:-/tmp/SBo}
  59. PKG=$TMP/package-$PRGNAM
  60. OUTPUT=${OUTPUT:-/tmp}
  61. if [ "$ARCH" = "i586" ]; then
  62. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  63. LIBDIRSUFFIX=""
  64. elif [ "$ARCH" = "i686" ]; then
  65. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  66. LIBDIRSUFFIX=""
  67. elif [ "$ARCH" = "x86_64" ]; then
  68. SLKCFLAGS="-O2 -fPIC"
  69. LIBDIRSUFFIX="64"
  70. else
  71. SLKCFLAGS="-O2"
  72. LIBDIRSUFFIX=""
  73. fi
  74. set -eu
  75. rm -rf $PKG
  76. mkdir -p $TMP $PKG $OUTPUT
  77. cd $TMP
  78. rm -rf ${SRCNAM}-${VERSION}
  79. tar xvf $CWD/${SRCNAM}-${VERSION}.tar.gz
  80. cd $SRCNAM-${VERSION}
  81. chown -R root:root .
  82. find -L . \
  83. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  84. -o -perm 511 \) -exec chmod 755 {} \; -o \
  85. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  86. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  87. # Patch to force using system libzen and error out if not present
  88. patch -p1 < $CWD/remove-internal-libzen-support.patch
  89. # Make compiling the CLI version optional
  90. if [ "$CLI" == "yes" ]; then
  91. cd Project/GNU/CLI
  92. ./autogen.sh
  93. CFLAGS="$SLKCFLAGS" \
  94. CXXFLAGS="$SLKCFLAGS" \
  95. ./configure \
  96. --prefix=/usr \
  97. --libdir=/usr/lib${LIBDIRSUFFIX} \
  98. --sysconfdir=/etc \
  99. --localstatedir=/var \
  100. --mandir=/usr/man \
  101. --infodir=/usr/info \
  102. --docdir=/usr/doc/$PRGNAM-$VERSION \
  103. --localedir=/usr/share/locale \
  104. --disable-static \
  105. --enable-shared \
  106. --build=$ARCH-slackware-linux
  107. make
  108. make install DESTDIR=$PKG
  109. cd -
  110. CLIDOC=History_CLI.txt
  111. fi
  112. # Make compiling the GUI optional -- requires wxWidgets/wxPython
  113. if [ "$GUI" == "yes" ]; then
  114. # Error out if missing WxWidgets/wxPython rather than try downloading and compiling it
  115. cd Project/GNU/GUI
  116. sed -i 's|WxWidgets not yet compiled, try to compile|wxPython not found. Please install first.|' configure.ac
  117. sed -i 's|WxBuiltInCompile$|with_wxwidgets="no"|g' configure.ac
  118. ./autogen.sh
  119. ./configure \
  120. --prefix=/usr \
  121. --libdir=/usr/lib${LIBDIRSUFFIX} \
  122. --sysconfdir=/etc \
  123. --localstatedir=/var \
  124. --mandir=/usr/man \
  125. --infodir=/usr/info \
  126. --docdir=/usr/doc/$PRGNAM-$VERSION \
  127. --localedir=/usr/share/locale \
  128. --disable-static \
  129. --enable-shared \
  130. --build=$ARCH-slackware-linux
  131. make
  132. make install DESTDIR=$PKG
  133. cd -
  134. # We need an icon file
  135. install -D -m 0644 Source/Resource/Image/MediaInfo.png \
  136. $PKG/usr/share/pixmaps/mediainfo.png
  137. # Manually install the .desktop file
  138. install -D -m 0644 Project/GNU/GUI/mediainfo-gui.desktop \
  139. $PKG/usr/share/applications/mediainfo-gui.desktop
  140. GUIDOC=History_GUI.txt
  141. fi
  142. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  143. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  144. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  145. cp -a ${CLIDOC} ${GUIDOC} License.html LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION
  146. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  147. chmod 0644 $PKG/usr/doc/$PRGNAM-$VERSION/*
  148. mkdir -p $PKG/install
  149. cat $CWD/slack-desc > $PKG/install/slack-desc
  150. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  151. cd $PKG
  152. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE