aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia/x264/Makefile
blob: 6e6e0e47056a2d74a897d39206f54cfea1c5b96d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Created by: Michael Johnson <ahze@FreeBSD.org>
# $FreeBSD$
#
# Updating notes:
# We use the nightly tarballs for the *stable* branch of the git repo.
# X264_BUILD is the "core" number, and can always be found in x264.h.
# X264_COMMIT is the commit number, and can be found here:
# http://git.videolan.org/?p=x264.git;a=shortlog;h=refs/heads/stable
# To get X264_REV, you must checkout the git revision for the version to
# which you wish to update, and then run version.sh against it.
# Don't forget to update these for multimedia/libx264 as well:
# X264_BUILD, X264_REV, X264_COMMIT, X264_SNAPSHOT
#
# distinfo for this port and libx264 should always be *identical*.
#
# Bumping PORTREVISION for dependent ports? This is useful:
# cd $PORTSDIR; for x in $(find . -name "Makefile*" -print);
# do str=$(grep -i x264.so $x); if [[ -n $str ]] { echo "$x" }; done

PORTNAME=   x264
PORTVERSION=    0.${X264_BUILD}.${X264_REV}
PORTREVISION=   1
CATEGORIES= multimedia
MASTER_SITES=   ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ \
        http://samples.mplayerhq.hu/yuv4mpeg2/:pgo
DISTNAME=   ${PORTNAME}-snapshot-${X264_SNAPSHOT}-2245-stable
DISTFILES=  ${DISTNAME}${EXTRACT_SUFX}
DIST_SUBDIR=    x264
EXTRACT_ONLY=   ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER= koobs@FreeBSD.org
COMMENT=    Front-end for encoding H.264/MPEG-4 AVC video

LICENSE=    GPLv2
LICENSE_FILE=   ${WRKSRC}/COPYING

BUILD_DEPENDS=  yasm>=0.6.0:${PORTSDIR}/devel/yasm \
        bash:${PORTSDIR}/shells/bash
LIB_DEPENDS=    libx264.so:${PORTSDIR}/multimedia/libx264

X264_BUILD= 142
X264_REV=   2455
X264_COMMIT=    021c0dc6c95c1bc239c9db78a80dd85fc856a4dd
X264_GITVER=    ${X264_COMMIT:C/^(.......).*$/\1/g}
X264_SNAPSHOT=  20140827

USES=       gmake pkgconfig tar:bzip2
WRKSRC=     ${WRKDIR}/${DISTNAME}
USE_LDCONFIG=   yes
HAS_CONFIGURE=  yes

OPTIONS_DEFINE=     ASM DEBUG GCC GPAC LAVF PGO
OPTIONS_DEFAULT=    ASM GPAC

GCC_DESC=       Use current GCC
GPAC_DESC=      MPEG-4 output support
LAVF_DESC=      libav* format input/output support (requires FFmpeg)

ASM_CONFIGURE_OFF=  --disable-asm
DEBUG_CONFIGURE_ON= --enable-debug
GPAC_LIB_DEPENDS=   libgpac.so:${PORTSDIR}/multimedia/gpac-libgpac
GPAC_CONFIGURE_OFF= --disable-gpac
LAVF_LIB_DEPENDS=   libavcodec.so:${PORTSDIR}/multimedia/ffmpeg \
            libavformat.so:${PORTSDIR}/multimedia/ffmpeg \
            libavutil.so:${PORTSDIR}/multimedia/ffmpeg \
            libswscale.so:${PORTSDIR}/multimedia/ffmpeg
LAVF_CONFIGURE_OFF= --disable-swscale --disable-lavf

CONFIGURE_ARGS+=    --extra-cflags="-I${LOCALBASE}/include" \
            --extra-ldflags="-L${LOCALBASE}/lib" \
            --disable-opencl \
            --system-libx264

PLIST_FILES=    bin/x264
PLIST_SUB+= X264_BUILD=${X264_BUILD}

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MGCC}
USE_GCC=    yes
.elif ${PORT_OPTIONS:MPGO}
USE_GCC=    any
.endif

.if ${PORT_OPTIONS:MPGO}
# y4m sample video
Y4M_VIDEO=      example.y4m
Y4M_VIDEO_DISTFILE= example.y4m.bz2

DISTFILES+= ${Y4M_VIDEO_DISTFILE}:pgo
ALL_TARGET= fprofiled
MAKE_ENV+=  VIDS="${WRKDIR}/${Y4M_VIDEO}"

RESTRICTED=     ${Y4M_VIDEO_DISTFILE} file may not be mirrored
RESTRICTED_FILES=   ${Y4M_VIDEO_DISTFILE}
.endif

post-extract:
.if ${PORT_OPTIONS:MPGO}
    @( cd ${WRKDIR} && ${BZIP2_CMD} -dc ${DISTDIR}/${DIST_SUBDIR}/${Y4M_VIDEO_DISTFILE} > ${Y4M_VIDEO} )
.endif

post-patch:
    @${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|; \
        s|-lpthread|${PTHREAD_LIBS}|g; \
        s|/bin/bash|${LOCALBASE}/bin/bash|; \
        s|gpac_static|gpac|g' \
        ${WRKSRC}/configure
    @${REINPLACE_CMD} -e 's|bash|sh|; \
        s|VER="x"|VER="${X264_REV} ${X264_GITVER}"|; \
        s|VERSION=""|VERSION=" r${X264_REV} ${X264_GITVER}"|' \
        ${WRKSRC}/version.sh

pre-build:
    @(${RM} ${WRKSRC}/x264_config.h)

post-install:
    ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/x264

.include <bsd.port.mk>