summaryrefslogtreecommitdiffstats
path: root/multimedia/x264-devel/Makefile
blob: f2bf0d54d4a486808a602f4d57aa4b50cc961545 (plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# New ports collection makefile for:	x264
# Date created:		2005-01-11
# Whom:			Michael Johnson <ahze@FreeBSD.org>
#
# $FreeBSD$

PORTNAME=	x264
PORTVERSION=	0.${X264_BUILD}.${X264_REV}
CATEGORIES=	multimedia
MASTER_SITES=	${MASTER_SITE_LOCAL} \
		http://samples.mplayerhq.hu/yuv4mpeg2/:pgo
MASTER_SITE_SUBDIR=	mm/x264
PKGNAMESUFFIX=	-devel
DISTNAME=	${PORTNAME}-${X264_GITVER}
DISTFILES=	${DISTNAME}.tar.xz
DIST_SUBDIR=	x264
EXTRACT_ONLY=	${DISTFILES}

MAINTAINER=	mm@FreeBSD.org
COMMENT=	Library and tool for encoding H.264/AVC video streams

LICENSE=	GPLv2
LICENSE_FILE=	${WRKSRC}/COPYING

BUILD_DEPENDS=	yasm>=0.6.0:${PORTSDIR}/devel/yasm \
		${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils \
		${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash

CONFLICTS=	x264-0.*

LATEST_LINK=	x264-devel

X264_BUILD=	124
X264_REV=	2197
X264_COMMIT=	69a0443e7d8ab032a7f3c3468a42177d5e64daa2
X264_GITVER=	${X264_COMMIT:C/^(.......).*$/\1/g}

USE_XZ=		yes
WRKSRC=		${WRKDIR}/${DISTNAME}
USE_GMAKE=	yes
USE_LDCONFIG=	yes
HAS_CONFIGURE=	yes
MAKE_JOBS_SAFE=	yes

OPTIONS=	DEBUG "Enable Debugging" Off \
		PGO "Enable Profile-Guided Optimization" Off \
		GCC44 "Use gcc 4.4+" Off \
		GPAC "Enable MPEG-4 Output" On \
		X11_OUTPUT "Enable X11 Output" Off

CONFIGURE_ARGS+=	--extra-cflags="${CPPFLAGS} ${CFLAGS} -fPIC -I${LOCALBASE}/include" \
			--extra-ldflags="${LDFLAGS} -L${LOCALBASE}/lib" \
			--enable-static --enable-shared

CONFIGURE_ENV+=		COMPILER_PATH=${LOCALBASE}/bin
MAKE_ENV+=		COMPILER_PATH=${LOCALBASE}/bin

PLIST_SUB+=		X264_BUILD=${X264_BUILD}

.include <bsd.port.pre.mk>

.if defined(WITH_GCC44)
USE_GCC?=	4.4+
.endif

# Around the time GCC stack protection (aka Propolice) for userland
# was enabled on src/share/mk/bsd.sys.mk
# SVN rev 180012 on 2008-06-25 21:33:28Z by ru
.if ${OSVERSION} >= 800040
LDFLAGS+=	-fstack-protector
.endif

CONFIGURE_ENV+=	ARCH= \
		TARGET_ARCH=
MAKE_ENV+=	ARCH= \
		TARGET_ARCH=

.if defined(WITH_DEBUG)
CONFIGURE_ARGS+=	--enable-debug
.endif

.if defined(WITH_PGO) && ${SLAVE_PORT:L}!="yes"
# 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

.if !defined(WITHOUT_GPAC)
BUILD_DEPENDS+=		gpac-libgpac>=0.4.5,1:${PORTSDIR}/multimedia/gpac-libgpac
LIB_DEPENDS+=		gpac.1:${PORTSDIR}/multimedia/gpac-libgpac
CONFIGURE_ARGS+=	--enable-gpac
.else
CONFIGURE_ARGS+=	--disable-gpac
.endif

.if defined(WITH_X11_OUTPUT)
CONFIGURE_ARGS+=	--enable-visualize
USE_XORG=	x11
.endif

post-extract:
.if defined(WITH_PGO) && ${SLAVE_PORT:L}!="yes"
	@( 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|' ${WRKSRC}/version.sh
	@${REINPLACE_CMD} -e 's|$$(libdir)/pkgconfig|${PREFIX}/libdata/pkgconfig|; \
		s|$${libdir}/pkgconfig|${PREFIX}/libdata/pkgconfig|' \
		${WRKSRC}/Makefile
.if !defined(WITH_GCC44)
	@${REINPLACE_CMD} -e 's|$$(CC) -shared -o|COMPILER_PATH= $$(CC) -shared -o|g' \
		-e 's|$$(CC) -o|COMPILER_PATH= $$(CC) -o|g' \
		${WRKSRC}/Makefile
.endif

.if ${SLAVE_PORT:L}=="no"
.if 0 # BROKEN
post-build:
	cd ${WRKSRC}/tools && ${MAKE} avc2avi

pre-install:
	@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|' \
		${WRKSRC}/x264.pc

post-install:
	${INSTALL_PROGRAM} ${WRKSRC}/tools/avc2avi ${PREFIX}/bin
.endif # BROKEN
.endif

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud