You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

419 lines
14 KiB

8 years ago
#!/bin/sh
# Generated by Alien's SlackBuild Toolkit: http://slackware.com/~alien/AST
# Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015 Eric Hameleers, Eindhoven, Netherlands
# Copyright 2015-2017 Thorn Inurcide
# Copyright 2015-2017 tde-slackbuilds project on GitHub
8 years ago
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for
# any purpose with or without fee is hereby granted, provided that
# the above copyright notice and this permission notice appear in all
# copies.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
PRGNAM=k3b
PKGNAM=$TDEPFX$PRGNAM
VERSION=$TDEVERSION
8 years ago
BUILD=${BUILD:-1}
TAG=${TAG:-_tde}
source ../../get-source.sh
getsource_fn
8 years ago
# Check for ffmpeg:
pkg-config libavcodec && FFMPEG="ON"
# Check for lame:
ldconfig -p|grep libmp3lame 1>/dev/null && LAME="ON" # [use ldconfig - no .pc file]
# Check for musepack:
[[ $(cat $TMPVARS/PRE_DOWNLOAD) != yes ]] && {
# ### musepack - start
musepack_installed_fn () { ldconfig -p|grep libmpcdec 1>/dev/null ;} # [use ldconfig - no .pc file]
## If it's already installed, go to MUSEPACK="ON"
musepack_installed_fn || {
## otherwise, if the source archive is in 'src' ..
[[ -s $BUILD_TDE_ROOT/src/libmpcdec-1.2.6.tar.bz2 ]] && {
## .. build, package, and install it
(
echo -e "\n building musepack decoder \n"
cd /$TMP_BUILD
rm -rf *libmpcdec*
tar xf $BUILD_TDE_ROOT/src/libmpcdec-1.2.6.tar.bz2
cd libmpcdec-1.2.6/
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
CC=$COMPILER \
CXX=$COMPILER_CXX \
./configure --libdir=\${exec_prefix}/lib${LIBDIRSUFFIX} --disable-static
make
DESTDIR=$TMP_BUILD/package-libmpcdec make install-strip
cd $TMP_BUILD/package-libmpcdec
makepkg -l y -c n $OUTPUT/libmpcdec-1.2.6-$ARCH-$BUILD.txz
installpkg $OUTPUT/libmpcdec-1.2.6-$ARCH-$BUILD.txz
)
musepack_installed_fn || { echo -e " installation of musepack decoder failed \n" ; exit 1 ; }
touch $TMPVARS/k3b-opts-built
}
} && \
MUSEPACK="ON"
# ### musepack - end
}
# Check for musicbrainz:
[[ $(cat $TMPVARS/PRE_DOWNLOAD) != yes ]] && {
# ### musicbrainz - start
musicbrainz_installed_fn () { pkg-config libmusicbrainz ;}
## If it's already installed, go to MUSICBRAINZ="ON"
musicbrainz_installed_fn || {
## otherwise, if the source archive is in 'src' ..
[[ -s $BUILD_TDE_ROOT/src/libmusicbrainz-2.1.5.tar.gz ]] && {
## .. build, package, and install it
(
echo -e "\n building libmusicbrainz \n"
cd /$TMP_BUILD
rm -rf *libmusicbrainz*
tar xf $BUILD_TDE_ROOT/src/libmusicbrainz-2.1.5.tar.gz
cd libmusicbrainz-2.1.5/
## patch for string.h - thanks to SBo - see https://slackbuilds.org/slackbuilds/14.2/libraries/libmusicbrainz/libmusicbrainz-2.1.5-include_stringh.patch
echo $'--- lib/c_wrapper.cpp
+++ lib/c_wrapper.cpp
@@ -23,0 +24 @@
+#include <string.h>
--- lib/comhttpsocket.cpp
+++ lib/comhttpsocket.cpp
@@ -21,0 +22 @@
+#include <string.h>
--- lib/comsocket.cpp
+++ lib/comsocket.cpp
@@ -39,0 +40 @@
+#include <string.h>
--- lib/http.cpp
+++ lib/http.cpp
@@ -26,0 +27 @@
+#include <string.h>
--- lib/sigclient.cpp
+++ lib/sigclient.cpp
@@ -35,0 +36 @@
+#include <string.h>
' | patch -p0
## patch for gcc6 - thanks to Archlinux - see https://bugs.archlinux.org/task/50754?getfile=14619
echo $'--- lib/sigclient.cpp
+++ lib/sigclient.cpp
@@ -42,4 +42,4 @@
-char tooShortTRM[] = { 0xf9, 0x80, 0x9a, 0xb1, 0x2b, 0x0f, 0x4d, 0x78,
- 0x88, 0x62, 0xfb, 0x42, 0x5a, 0xde, 0x8a, 0xb9 };
-char sigserverBusyTRM[] = { 0xc4, 0x57, 0xa4, 0xa8, 0xb3, 0x42, 0x4e, 0xc9,
- 0x8f, 0x13, 0xb6, 0xbd, 0x26, 0xc0, 0xe4, 0x00 };
+char tooShortTRM[] = { (char)0xf9, (char)0x80, (char)0x9a, (char)0xb1, (char)0x2b, (char)0x0f, (char)0x4d, (char)0x78,
+ (char)0x88, (char)0x62, (char)0xfb, (char)0x42, (char)0x5a, (char)0xde, (char)0x8a, (char)0xb9 };
+char sigserverBusyTRM[] = { (char)0xc4, (char)0x57, (char)0xa4, (char)0xa8, (char)0xb3, (char)0x42, (char)0x4e, (char)0xc9,
+ (char)0x8f, (char)0x13, (char)0xb6, (char)0xbd, (char)0x26, (char)0xc0, (char)0xe4, (char)0x00 };
--- lib/signature.cpp
+++ lib/signature.cpp
@@ -48,2 +48,2 @@
-char silenceTRM[] = { 0x7d, 0x15, 0x4f, 0x52, 0xb5, 0x36, 0x4f, 0xae,
- 0xb5, 0x8b, 0x06, 0x66, 0x82, 0x6c, 0x2b, 0xac, 0x00 };
+char silenceTRM[] = { (char)0x7d, (char)0x15, (char)0x4f, (char)0x52, (char)0xb5, (char)0x36, (char)0x4f, (char)0xae,
+ (char)0xb5, (char)0x8b, (char)0x06, (char)0x66, (char)0x82, (char)0x6c, (char)0x2b, (char)0xac, (char)0x00 };
' | patch -p0
## work-around for gcc11+ - see https://gcc.gnu.org/gcc-11/porting_to.html
[[ $(gcc --version) == *1[1-9]* ]] && CXXFLAGS_="-std=gnu++14"
## clang build
## comhttpsocket.cpp:25:44: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
## const char* g_strCOMVer = "libmusicbrainz/"VERSION;
## ^
[[ $COMPILER_CXX == clang++ ]] && {
sed -i 's|"VERSION|" VERSION|' lib/comhttpsocket.cpp
sed -i 's|"VERSION|" VERSION|' lib/musicbrainz.cpp
}
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS ${CXXFLAGS_:-}" \
CC=$COMPILER \
CXX=$COMPILER_CXX \
./configure --libdir=\${exec_prefix}/lib${LIBDIRSUFFIX} --disable-static
make
DESTDIR=$TMP_BUILD/package-libmusicbrainz make install-strip
cd $TMP_BUILD/package-libmusicbrainz
makepkg -l y -c n $OUTPUT/libmusicbrainz-2.1.5-$ARCH-$BUILD.txz
installpkg $OUTPUT/libmusicbrainz-2.1.5-$ARCH-$BUILD.txz
)
musicbrainz_installed_fn || { echo -e " installation of Musicbrainz failed \n" ; exit 1 ; }
touch $TMPVARS/k3b-opts-built
}
} && \
MUSICBRAINZ="ON"
# ### musicbrainz - end
}
[[ -e $TMPVARS/k3b-opts-built ]] && echo -e "\n now building k3b \n" && rm $TMPVARS/k3b-opts-built
untar_fn
8 years ago
## Re: commit 1f4a3ab
## Make s_codecFeatures a "const char *" to remove ISO C++ warning
patch -N -p0 << EOF || true
--- libk3b/jobs/k3bvideodvdtitletranscodingjob.cpp
+++ libk3b/jobs/k3bvideodvdtitletranscodingjob.cpp
@@ -564,1 +564,1 @@
- static char* s_codecFeatures[] = { "xvid", "ffmpeg" };
+ static const char* s_codecFeatures[] = { "xvid", "ffmpeg" };
@@ -575,1 +575,1 @@
- static char* s_codecFeatures[] = { "lame", "ac3", "ac3" };
+ static const char* s_codecFeatures[] = { "lame", "ac3", "ac3" };
EOF
## Re: 14.0.x, commits fad8c63 & ea1dbe7
## Enable ffmpeg 5.0 compatibility
patch -N -p0 << EOF || true
--- plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
+++ plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
@@ -36,4 +36,2 @@
-#define FFMPEG_CODEC(s) (s->codec)
-
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 101, 0)
@@ -105,3 +103,7 @@
+ ::AVCodecContext *audio_stream_ctx;
::AVSampleFormat sampleFormat;
::AVFrame *frame;
- ::AVPacket packet;
+ ::AVPacket *packet;
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 12, 100)
+ ::AVPacket _packet;
+#endif
@@ -120,2 +122,4 @@
+ d->audio_stream_ctx = NULL;
d->frame = av_frame_alloc();
d->outputBufferPos = NULL;
+ d->packet = NULL;
@@ -161,16 +165,37 @@
- ::AVCodecContext *codecContext = FFMPEG_CODEC(d->audio_stream);
- if (codecContext->codec_type != AVMEDIA_TYPE_AUDIO) {
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)
+ if (d->audio_stream->codecpar->codec_type != AVMEDIA_TYPE_AUDIO)
+#else
+ d->audio_stream_ctx = d->audio_stream->codec;
+ if (d->audio_stream_ctx->codec_type != AVMEDIA_TYPE_AUDIO)
+#endif
+ {
kdDebug() << "(K3bFFMpegFile) not a simple audio stream: " << m_filename;
return false;
}
// get the codec
- d->codec = ::avcodec_find_decoder(codecContext->codec_id);
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)
+ d->codec = (AVCodec *)::avcodec_find_decoder(d->audio_stream->codecpar->codec_id);
+#else
+ d->codec = (AVCodec *)::avcodec_find_decoder(d->audio_stream_ctx->codec_id);
+#endif
if (!d->codec) {
kdDebug() << "(K3bFFMpegFile) no codec found for " << m_filename;
return false;
}
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)
+ // allocate a codec context
+ d->audio_stream_ctx = avcodec_alloc_context3(d->codec);
+ if (d->audio_stream_ctx) {
+ avcodec_parameters_to_context(d->audio_stream_ctx, d->audio_stream->codecpar);
+ }
+ else {
+ kdDebug() << "(K3bFFMpegFile) failed to allocate a codec context for "
+ << m_filename;
+ }
+#endif
+
// open the codec on our context
- kdDebug() << "(K3bFFMpegFile) found codec for " << m_filename;
- if (::avcodec_open2(codecContext, d->codec, NULL) < 0) {
+ kdDebug() << "(K3bFFMpegFile) found codec for " << m_filename << endl;
+ if (::avcodec_open2(d->audio_stream_ctx, d->codec, NULL) < 0) {
@@ -210,2 +235,6 @@
- ::avcodec_close(FFMPEG_CODEC(d->audio_stream));
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 63, 100)
+ ::avcodec_free_context(&d->audio_stream_ctx);
+#else
+ ::avcodec_close(d->audio_stream_ctx);
d->codec = NULL;
+#endif
@@ -304,7 +333,12 @@
- ::av_init_packet(&d->packet);
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
+ d->packet = ::av_packet_alloc();
+#else
+ ::av_init_packet(&d->_packet);
+ d->packet = &d->_packet;
+#endif
- if (::av_read_frame(d->formatContext, &d->packet) < 0) {
+ if (::av_read_frame(d->formatContext, d->packet) < 0) {
return 0;
}
- d->packetSize = d->packet.size;
- d->packetData = d->packet.data;
+ d->packetSize = d->packet->size;
+ d->packetData = d->packet->data;
@@ -327,10 +361,37 @@
- int len = ::avcodec_decode_audio4(FFMPEG_CODEC(d->audio_stream), d->frame,
- &gotFrame, &d->packet);
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
+ int len = avcodec_receive_frame(d->audio_stream_ctx, d->frame);
+ if (len == 0) {
+ gotFrame = 1;
+ }
+ else if (len == AVERROR(EAGAIN)) {
+ len = 0;
+ }
+
+ if (len == 0) {
+ len = avcodec_send_packet(d->audio_stream_ctx, d->packet);
+ if (len == AVERROR(EAGAIN)) {
+ len = 0;
+ }
+ }
+#else
+ int len = ::avcodec_decode_audio4(d->audio_stream_ctx, d->frame,
+ &gotFrame, d->packet);
+#endif
- if (d->packetSize <= 0 || len < 0)
- ::av_packet_unref(&d->packet);
+ if (d->packetSize <= 0 || len < 0) {
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
+ ::av_packet_free(&d->packet);
+#else
+ ::av_packet_unref(d->packet);
+ d->packet = NULL;
+#endif
+ }
if (len < 0) {
kdDebug() << "(K3bFFMpegFile) decoding failed for " << m_filename;
return -1;
}
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
+ len = d->packet->size;
+#endif
+
@@ -389,1 +450,5 @@
-K3bFFMpegWrapper::K3bFFMpegWrapper() { ::av_register_all(); }
+K3bFFMpegWrapper::K3bFFMpegWrapper() {
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58,9,100)
+ ::av_register_all();
+#endif
+}
EOF
## using cmake common rules
find doc -name CMakeLists.txt | xargs rm
sed -i '/tde_conditional_add_subdirectory( BUILD_DOC doc )/d' CMakeLists.txt
sed -i 's|k3bsetup )|&\
\
\
##### other data\
\
tde_conditional_add_project_docs( BUILD_DOC )|' CMakeLists.txt
mv doc/tdeioslave doc/en
mv doc/en/en doc/en/tdeioslave
3 years ago
mv doc/*.* doc/en/
mkdir doc/misc
mv FAQ doc/misc/
listdocs_fn
8 years ago
chown_fn
8 years ago
cd_builddir_fn
cmake ${G_NINJA:-} \
-DCMAKE_C_FLAGS="$SLKRCFLAGS" \
-DCMAKE_CXX_FLAGS="$SLKRCFLAGS" \
-DCMAKE_C_COMPILER=$COMPILER \
-DCMAKE_CXX_COMPILER=$COMPILER_CXX \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_TDE \
-DLIB_SUFFIX=$LIBDIRSUFFIX \
-DPLUGIN_INSTALL_DIR=$INSTALL_TDE/lib$LIBDIRSUFFIX/$PLUGIN_INSTALL_DIR \
8 years ago
-DWITH_LIBDVDREAD="ON" \
-DWITH_MUSICBRAINZ=${MUSICBRAINZ:-"OFF"} \
8 years ago
-DWITH_SYSTEM_LIBSAMPLERATE="ON" \
-DWITH_HAL="OFF" \
-DWITH_DEBUG="OFF" \
-DWITH_ALSA="ON" \
-DWITH_ARTS="ON" \
-DWITH_FFMPEG=${FFMPEG:-"OFF"} \
3 years ago
-DWITH_FFMPEG_ALL_CODECS=${FFMPEG:-"OFF"} \
8 years ago
-DWITH_FLAC="ON" \
-DWITH_SNDFILE="ON" \
-DWITH_TAGLIB="ON" \
-DWITH_MAD="ON" \
-DWITH_MUSEPACK=${MUSEPACK:-"OFF"} \
8 years ago
-DWITH_VORBIS="ON" \
-DWITH_LAME=${LAME:-"OFF"} \
8 years ago
-DBUILD_K3BSETUP="ON" \
-DBUILD_DOC="ON" \
-Wno-dev \
8 years ago
..
make_fn
installdocs_fn
8 years ago
strip_fn
8 years ago
mkdir_install_fn
8 years ago
doinst_sh_fn
PRGNAM=$PKGNAM
echo "
# HOW TO EDIT THIS FILE:
# The 'handy ruler' below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: K3b (The CD Creator, TDE $TDEVERSION version)
$PRGNAM:
$PRGNAM: K3b makes writing cds under Linux easy. It has an easy to use
$PRGNAM: interface and supports CD burning (including on-the-fly), copying,
$PRGNAM: erasing, ripping, and more.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
" > $PKG/install/slack-desc
8 years ago
makepkg_fn