freebsd-ports/multimedia/k9copy-kde4/Makefile
Raphael Kubo da Costa 1624e7c81f Fix the build with the upcoming CMake 3.4.0.
It is not clear if this is intentional or not, but with CMake 3.4.0
environment variables such as CXXFLAGS are passed to the compiler after the
directories added via the include_directories() command. In practice, this
means that we then end up with the following command-line:

  ${CXX} ... -I/usr/local/include ...
             -I/usr/local/include/ffmpeg0/libavcodec
             -I/usr/local/include/ffmpeg0 ...

which fails because of the following chain of events:
* The port brings in multimedia/ffmpeg indirectly.
* The source code includes headers as <avformat.h> like that, which turn
  into /usr/local/include/ffmpeg0/libavformat/avformat.h to the compiler.
* Headers like avformat.h itself include other headers with
  "libavcodec/avcodec.h", which, given the compiler command-line above,
  becomes /usr/local/include/libavcodec/avcodec.h, coming from
  multimedia/ffmpeg, not multimedia/ffmpeg0.

Fix it by making the port behave as it should have from the beginning:
* Stop setting C{PP,XX}FLAGS in the Makefile, as it does not help.
* Include the ffmpeg-related headers before the others, so that
  /usr/local/include comes after them.
* Adjust patch-cmake so that it works correctly with the setup in ports:
  instead of setting the <LIB>_LAVC variables which assume there is a
  separate libavcodec installed, make the code fall back to the
  <LIB>_FF_LAVC ones, which are set when there's a libavcodec inside an
  ffmpeg tree (our case with ffmpeg0). This also takes care of setting
  FFMPEG_INCLUDE_DIR with /usr/local/include/ffmpeg0 and passing it in the
  right place in the command-line.

Tested with both CMake 3.3.1 and 3.4.0.
2015-11-26 17:21:13 +00:00

41 lines
1.2 KiB
Makefile

# Created by: Alexander V. Ribchansky <triosoft@triosoft.com.ua>
# $FreeBSD$
PORTNAME= k9copy
PORTVERSION= 2.3.4
PORTREVISION= 14
CATEGORIES= multimedia kde
MASTER_SITES= LOCAL/rakuco
DISTNAME= ${PORTNAME}-${PORTVERSION}-Source
MAINTAINER= egoliveira@gmail.com
COMMENT= DVD-9 to DVD-5 shrinking application for KDE
LICENSE= GPLv2
LIB_DEPENDS= libxine.so:${PORTSDIR}/multimedia/libxine \
libmpeg2.so:${PORTSDIR}/multimedia/libmpeg2 \
libavcodec0.so:${PORTSDIR}/multimedia/ffmpeg0
USES= cmake gettext
USE_KDE4= kdeprefix kdelibs automoc4
USE_QT4= moc_build qmake_build rcc_build uic_build
OPTIONS_DEFINE= MENCODER MPLAYER DVDAUTHOR
MENCODER_DESC= MEncoder support
MPLAYER_DESC= MPlayer support
DVDAUTHOR_DESC= DVD Author support
MENCODER_RUN_DEPENDS= mencoder:${PORTSDIR}/multimedia/mencoder
MPLAYER_RUN_DEPENDS= mplayer:${PORTSDIR}/multimedia/mplayer
DVDAUTHOR_RUN_DEPENDS= dvdauthor:${PORTSDIR}/multimedia/dvdauthor
post-patch:
@${REINPLACE_CMD} -e 's,%%LOCALBASE%%,${LOCALBASE},g' ${WRKSRC}/cmake/*.cmake
@${REINPLACE_CMD} \
-e 's,swscale,swscale0,' \
-e 's,avcodec,avcodec0,' \
-e 's,avformat,avformat0,' \
${WRKSRC}/CMakeLists.txt
.include <bsd.port.mk>