rules.mak 3.75 KB
Newer Older
Edric Milaret's avatar
Edric Milaret committed
1
FFMPEG_HASH := c40983a6f631d22fede713d535bb9c31d5c9740c
2
FFMPEG_URL := https://git.ffmpeg.org/gitweb/ffmpeg.git/snapshot/$(FFMPEG_HASH).tar.gz
Edric Milaret's avatar
Edric Milaret committed
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

ifdef HAVE_WIN32
PKGS += ffmpeg
endif

FFMPEGCONF = \
		--cc="$(CC)" \
		--pkg-config="$(PKG_CONFIG)"

#disable everything
FFMPEGCONF += \
		--disable-everything \
		--enable-zlib \
		--enable-gpl \
		--enable-swscale \
		--enable-protocols \
		--disable-programs \
		--disable-sdl

#enable muxers/demuxers
FFMPEGCONF += \
		--enable-demuxers \
		--enable-muxers

#enable parsers
FFMPEGCONF += \
		--enable-parser=h263 \
		--enable-parser=h264 \
		--enable-parser=mpeg4video \
		--enable-parser=vp8

#librairies
35
ifndef HAVE_ANDROID
Edric Milaret's avatar
Edric Milaret committed
36 37 38
FFMPEGCONF += \
		--enable-libx264 \
		--enable-libvpx
39
endif
Edric Milaret's avatar
Edric Milaret committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

#encoders/decoders
FFMPEGCONF += \
		--enable-encoder=adpcm_g722 \
		--enable-decoder=adpcm_g722 \
		--enable-encoder=rawvideo \
		--enable-decoder=rawvideo \
		--enable-encoder=libx264 \
		--enable-decoder=h264 \
		--enable-encoder=pcm_alaw \
		--enable-decoder=pcm_alaw \
		--enable-encoder=pcm_mulaw \
		--enable-decoder=pcm_mulaw \
		--enable-encoder=mpeg4 \
		--enable-decoder=mpeg4 \
		--enable-encoder=libvpx_vp8 \
		--enable-decoder=vp8 \
		--enable-encoder=h263 \
Éloi Bail's avatar
Éloi Bail committed
58
		--enable-encoder=h263p \
Edric Milaret's avatar
Edric Milaret committed
59 60 61 62
		--enable-decoder=h263 \
		--enable-encoder=mjpeg \
		--enable-decoder=mjpeg \
		--enable-decoder=mjpegb \
Edric Milaret's avatar
Edric Milaret committed
63 64 65
		--enable-libspeex \
		--enable-libopus \
		--enable-encoder=libspeex \
Edric Milaret's avatar
Edric Milaret committed
66 67 68
		--enable-decoder=libspeex \
		--enable-encoder=libopus \
		--enable-decoder=libopus
Edric Milaret's avatar
Edric Milaret committed
69

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#encoders/decoders for images
FFMPEGCONF += \
		--enable-encoder=gif \
		--enable-decoder=gif \
		--enable-encoder=jpegls \
		--enable-decoder=jpegls \
		--enable-encoder=ljpeg \
		--enable-decoder=jpeg2000 \
		--enable-encoder=png \
		--enable-decoder=png \
		--enable-encoder=bmp \
		--enable-decoder=bmp \
		--enable-encoder=tiff \
		--enable-decoder=tiff

85
ifdef HAVE_WIN32
Edric Milaret's avatar
Edric Milaret committed
86 87
FFMPEGCONF += \
	--enable-indev=dshow \
88
	--enable-indev=gdigrab \
Edric Milaret's avatar
Edric Milaret committed
89
	--enable-dxva2
90
endif
Edric Milaret's avatar
Edric Milaret committed
91 92 93

DEPS_ffmpeg = iconv zlib x264 vpx opus speex $(DEPS_vpx)

94 95 96 97 98 99 100 101 102
ifdef HAVE_IOS
FFMPEGCONF += \
	--target-os=darwin \
	--enable-cross-compile \
	--arch=$(ARCH) \
	--enable-pic \
        --enable-indev=avfoundation
endif

103 104 105 106 107 108 109 110 111 112 113 114
# Linux
ifdef HAVE_LINUX
FFMPEGCONF += --target-os=linux --enable-pic
ifndef HAVE_ANDROID
FFMPEGCONF += --enable-indev=v4l2 --enable-indev=x11grab --enable-x11grab
else
# used to avoid Text Relocations
FFMPEGCONF += --extra-cxxflags=-fPIC --extra-cflags=-fPIC
FFMPEGCONF += --disable-asm
endif
endif

115
ifndef HAVE_IOS
Edric Milaret's avatar
Edric Milaret committed
116 117 118
ifdef HAVE_CROSS_COMPILE
FFMPEGCONF += --cross-prefix=$(HOST)-
endif
119
endif
Edric Milaret's avatar
Edric Milaret committed
120 121 122 123 124 125 126 127 128 129

# x86 stuff
ifeq ($(ARCH),i386)
FFMPEGCONF += --arch=x86
endif

ifeq ($(ARCH),x86_64)
FFMPEGCONF += --arch=x86_64
endif

130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
# ARM stuff
ifeq ($(ARCH),arm)
FFMPEGCONF += --arch=arm
ifdef HAVE_NEON
FFMPEGCONF += --enable-neon
endif
ifdef HAVE_ARMV7A
FFMPEGCONF += --cpu=cortex-a8
endif
ifdef HAVE_ARMV6
FFMPEGCONF += --cpu=armv6 --disable-neon
endif
endif

# ARM64 stuff
ifeq ($(ARCH),aarch64)
FFMPEGCONF += --arch=aarch64
endif

Edric Milaret's avatar
Edric Milaret committed
149 150 151 152 153 154 155
# Windows
ifdef HAVE_WIN32
FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
FFMPEGCONF += --enable-w32threads --disable-decoder=dca
endif

ifeq ($(call need_pkg,"ffmpeg >= 2.6.1"),)
156
PKGS_FOUND += ffmpeg
Edric Milaret's avatar
Edric Milaret committed
157 158 159
endif

$(TARBALLS)/ffmpeg-$(FFMPEG_HASH).tar.xz:
160
	$(call download,$(FFMPEG_URL))
Edric Milaret's avatar
Edric Milaret committed
161 162

.sum-ffmpeg: ffmpeg-$(FFMPEG_HASH).tar.xz
163
	$(warning $@ is not implemented.)
Edric Milaret's avatar
Edric Milaret committed
164 165 166 167 168 169 170 171 172 173 174
	touch $@

ffmpeg: ffmpeg-$(FFMPEG_HASH).tar.xz .sum-ffmpeg
	rm -Rf $@ $@-$(FFMPEG_HASH)
	mkdir -p $@-$(FFMPEG_HASH)
	(cd $@-$(FFMPEG_HASH) && tar xv --strip-components=1 -f ../$<)
	$(UPDATE_AUTOCONFIG)
	$(MOVE)

.ffmpeg: ffmpeg
	cd $< && $(HOSTVARS) ./configure \
175
		--extra-cflags="$(CFLAGS)" \
Edric Milaret's avatar
Edric Milaret committed
176
		--extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
177
                --prefix="$(PREFIX)" --enable-static --disable-shared
Edric Milaret's avatar
Edric Milaret committed
178 179
	cd $< && $(MAKE) install-libs install-headers
	touch $@