Branch: master

848ce5de 2016-10-13 14:31:45 François Andriot
RPM packaging: switch k3b to cmake build
M redhat/applications/k3b/k3b-14.0.0.spec
diff --git a/redhat/applications/k3b/k3b-14.0.0.spec b/redhat/applications/k3b/k3b-14.0.0.spec
index f1a5777..9e84ec4 100644
--- a/redhat/applications/k3b/k3b-14.0.0.spec
+++ b/redhat/applications/k3b/k3b-14.0.0.spec
@@ -67,7 +67,7 @@
 BuildRequires:	trinity-tdebase-devel >= %{tde_version}
 BuildRequires:	desktop-file-utils
 
-BuildRequires:	autoconf automake libtool m4
+BuildRequires:	cmake
 BuildRequires:	gcc-c++
 BuildRequires:	pkgconfig
 
@@ -182,7 +182,6 @@
 %endif
 
 # LAME support
-%if 0%{?mgaversion} || 0%{?mdkversion}
 %if 0%{?mdkversion} || 0%{?mgaversion} || 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
 %define with_lame 1
 %if 0%{?mgaversion} || 0%{?mdkversion}
@@ -197,7 +196,6 @@
 %endif
 %if 0%{?fedora} || 0%{?rhel}
 BuildRequires:	lame-devel
-%endif
 %endif
 %endif
 
@@ -405,71 +403,53 @@
 # set in k3brc too 
 %patch4 -p1 -b .manualbufsize
 
-%__cp -f "/usr/share/aclocal/libtool.m4" "admin/libtool.m4.in"
-%__cp -f "/usr/share/libtool/"*"/ltmain.sh" "admin/ltmain.sh" || %__cp -f "/usr/share/libtool/ltmain.sh" "admin/ltmain.sh"
-%__make -f "admin/Makefile.common"
-
 
 %build
 unset QTDIR QTINC QTLIB
 export PATH="%{tde_bindir}:${PATH}"
 export PKG_CONFIG_PATH="%{tde_libdir}/pkgconfig:${PKG_CONFIG_PATH}"
-export kde_confdir="%{tde_confdir}"
 
 # FFMPEG trick ...
 if [ -d /usr/include/ffmpeg ]; then
 	export CXXFLAGS="${RPM_OPT_FLAGS} -I/usr/include/ffmpeg"
 fi
 
-# Notice: extra-includes is required to find arts headers
-%configure \
-  --prefix=%{tde_prefix} \
-  --exec-prefix=%{tde_prefix} \
-  --bindir=%{tde_bindir} \
-  --datadir=%{tde_datadir} \
-  --libdir=%{tde_libdir} \
-  --mandir=%{tde_mandir} \
-  --includedir=%{tde_tdeincludedir} \
-  \
-  --disable-dependency-tracking \
-  --disable-debug \
-  --enable-new-ldflags \
-  --enable-final \
-  --enable-closure \
-  --enable-rpath \
-  --disable-gcc-hidden-visibility \
-  \
-  --with-extra-includes=%{tde_includedir} \
-  \
-  --with-k3bsetup=no \
-  --without-cdrecord-suid-root \
-  --with-oggvorbis \
-  --with-flac \
-  %{?with_samplerate:--with-external-libsamplerate} \
-  %{?with_dvdread:--with-libdvdread} %{?!with_dvdread:--without-libdvdread} \
-  --with-musicbrainz \
-  %{?with_sndfile:--with-sndfile} %{?!with_sndfile:--without-sndfile} \
-  %{?with_ffmpeg:--with-ffmpeg} %{?!with_ffmpeg:--without-ffmpeg} \
-  %{?with_lame:--with-lame} %{?!with_lame:--without-lame} \
-  %{?with_libmad:--with-libmad} %{?!with_libmad:--without-libmad} \
-  --with-musepack \
-  --without-resmgr \
-  %{?with_hal:--with-hal} %{?!with_hal:--without-hal} \
+if ! rpm -E %%cmake|grep -q "cd build"; then
+  %__mkdir_p build
+  cd build
+fi
 
-# Strange behaviour on RHEL4 ...
-%if 0%{?rhel} == 4
-%__sed -i "libk3b/jobs/Makefile" -e "/^am_libjobs_la_final_OBJECTS/ s/ lo//g"
-%__mkdir_p "libk3bdevice/.libs"
-%__ln_s . "libk3bdevice/.libs/.libs"
-%endif
+%cmake \
+  -DCMAKE_BUILD_TYPE="RelWithDebInfo" \
+  -DCMAKE_C_FLAGS="${RPM_OPT_FLAGS} -DNDEBUG" \
+  -DCMAKE_CXX_FLAGS="${RPM_OPT_FLAGS} -DNDEBUG" \
+  -DCMAKE_SKIP_RPATH=OFF \
+  -DCMAKE_INSTALL_RPATH="%{tde_libdir}" \
+  -DCMAKE_NO_BUILTIN_CHRPATH=ON \
+  -DCMAKE_VERBOSE_MAKEFILE=ON \
+  -DCMAKE_PROGRAM_PATH="%{tde_bindir}" \
+  -DWITH_GCC_VISIBILITY=OFF \
+  \
+  -DCMAKE_INSTALL_PREFIX=%{tde_prefix} \
+  -DBIN_INSTALL_DIR=%{tde_bindir} \
+  -DCONFIG_INSTALL_DIR="%{tde_confdir}" \
+  -DINCLUDE_INSTALL_DIR=%{tde_tdeincludedir} \
+  -DLIB_INSTALL_DIR=%{tde_libdir} \
+  -DSHARE_INSTALL_PREFIX=%{tde_datadir} \
+  \
+  -DWITH_ALL_OPTIONS="ON" \
+  -DWITH_MUSICBRAINZ="ON" \
+  -DWITH_FFMPEG_ALL_CODECS="ON" \
+  -DWITH_MUSEPACK="ON" \
+  ..
 
-%__make %{?_smp_mflags}
+%__make %{?_smp_mflags} || %__make
 
 
 %install
 export PATH="%{tde_bindir}:${PATH}"
 %__rm -rf %{buildroot}
-%__make install DESTDIR=%{buildroot}
+%__make install DESTDIR=%{?buildroot} -C build
 %__install -D -m 644 -p %{SOURCE2} %{buildroot}%{tde_confdir}/k3brc
 
 # remove the .la files