ffmpeg: fix style concerns for Solaris section
[vlc.git] / contrib / src / ffmpeg / rules.mak
1 # FFmpeg
2
3 #Uncomment the one you want
4 #USE_LIBAV ?= 1
5 #USE_FFMPEG ?= 1
6
7 ifdef USE_FFMPEG
8 HASH=HEAD
9 FFMPEG_SNAPURL := http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=$(HASH);sf=tgz
10 else
11 HASH=HEAD
12 FFMPEG_SNAPURL := http://git.libav.org/?p=libav.git;a=snapshot;h=$(HASH);sf=tgz
13 endif
14
15 FFMPEGCONF = \
16         --cc="$(CC)" \
17         --pkg-config="$(PKG_CONFIG)" \
18         --disable-doc \
19         --disable-encoder=vorbis \
20         --enable-libgsm \
21         --enable-libopenjpeg \
22         --disable-debug \
23         --disable-avdevice \
24         --disable-devices \
25         --disable-avfilter \
26         --disable-filters \
27         --disable-bsfs \
28         --disable-bzlib \
29         --disable-programs \
30         --disable-avresample
31
32 ifdef USE_FFMPEG
33 FFMPEGCONF += \
34         --disable-swresample \
35         --disable-iconv
36 endif
37
38 DEPS_ffmpeg = zlib gsm openjpeg
39
40 # Optional dependencies
41 ifndef BUILD_NETWORK
42 FFMPEGCONF += --disable-network
43 endif
44 ifdef BUILD_ENCODERS
45 FFMPEGCONF += --enable-libmp3lame --enable-libvpx --disable-decoder=libvpx --disable-decoder=libvpx_vp8 --disable-decoder=libvpx_vp9
46 DEPS_ffmpeg += lame $(DEPS_lame) vpx $(DEPS_vpx)
47 else
48 FFMPEGCONF += --disable-encoders --disable-muxers
49 endif
50
51 # Small size
52 ifdef ENABLE_SMALL
53 FFMPEGCONF += --enable-small
54 endif
55 ifeq ($(ARCH),arm)
56 ifdef HAVE_ARMV7A
57 FFMPEGCONF += --enable-thumb
58 endif
59 endif
60
61 ifdef HAVE_CROSS_COMPILE
62 FFMPEGCONF += --enable-cross-compile
63 ifndef HAVE_DARWIN_OS
64 FFMPEGCONF += --cross-prefix=$(HOST)-
65 endif
66 endif
67
68 # ARM stuff
69 ifeq ($(ARCH),arm)
70 ifndef HAVE_DARWIN_OS
71 FFMPEGCONF += --arch=arm
72 endif
73 ifdef HAVE_NEON
74 FFMPEGCONF += --enable-neon
75 endif
76 ifdef HAVE_ARMV7A
77 FFMPEGCONF += --cpu=cortex-a8
78 endif
79 ifdef HAVE_ARMV6
80 FFMPEGCONF += --cpu=armv6 --disable-neon
81 endif
82 endif
83
84 # MIPS stuff
85 ifeq ($(ARCH),mipsel)
86 FFMPEGCONF += --arch=mips
87 endif
88
89 # x86 stuff
90 ifeq ($(ARCH),i386)
91 ifndef HAVE_DARWIN_OS
92 FFMPEGCONF += --arch=x86
93 endif
94 endif
95
96 # Darwin
97 ifdef HAVE_DARWIN_OS
98 FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
99 ifeq ($(ARCH),x86_64)
100 FFMPEGCONF += --cpu=core2
101 endif
102 endif
103 ifdef HAVE_IOS
104 FFMPEGCONF += --enable-pic
105 ifdef HAVE_NEON
106 FFMPEGCONF += --as="$(AS)"
107 endif
108 endif
109 ifdef HAVE_MACOSX
110 FFMPEGCONF += --enable-vda
111 endif
112
113 # Linux
114 ifdef HAVE_LINUX
115 FFMPEGCONF += --target-os=linux --enable-pic
116
117 endif
118
119 # Windows
120 ifdef HAVE_WIN32
121 ifndef HAVE_MINGW_W64
122 DEPS_ffmpeg += directx
123 endif
124 FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
125 FFMPEGCONF += --enable-w32threads --enable-dxva2 \
126         --disable-decoder=dca
127
128 ifdef HAVE_WIN64
129 FFMPEGCONF += --cpu=athlon64 --arch=x86_64
130 else # !WIN64
131 FFMPEGCONF+= --cpu=i686 --arch=x86
132 endif
133
134 else # !Windows
135 FFMPEGCONF += --enable-pthreads
136 endif
137
138 # Solaris
139 ifdef HAVE_SOLARIS
140 ifeq ($(ARCH),x86_64)
141 FFMPEGCONF += --cpu=core2
142 endif
143 FFMPEGCONF += --target-os=sunos --enable-pic
144 endif
145
146 # Build
147 PKGS += ffmpeg
148 ifeq ($(call need_pkg,"libavcodec >= 54.25.0 libavformat >= 53.21.0 libswscale"),)
149 PKGS_FOUND += ffmpeg
150 endif
151
152 $(TARBALLS)/ffmpeg-$(HASH).tar.gz:
153         $(call download,$(FFMPEG_SNAPURL))
154
155 .sum-ffmpeg: $(TARBALLS)/ffmpeg-$(HASH).tar.gz
156         $(warning Not implemented.)
157         touch $@
158
159 ffmpeg: ffmpeg-$(HASH).tar.gz .sum-ffmpeg
160         rm -Rf $@ $@-$(HASH)
161         mkdir -p $@-$(HASH)
162         $(ZCAT) "$<" | (cd $@-$(HASH) && tar xv --strip-components=1)
163         $(MOVE)
164
165 .ffmpeg: ffmpeg
166         cd $< && $(HOSTVARS) ./configure \
167                 --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
168                 --prefix="$(PREFIX)" --enable-static --disable-shared
169         cd $< && $(MAKE) install-libs install-headers
170         touch $@