bunch of small fixes, add msg.txt to about prefs
[goodguy/history.git] / cinelerra-5.0 / thirdparty / Makefile
1
2 # to see the make rules:
3 #   make rules
4 #
5 # command uses:
6 #   ./configure <static/shared>
7 #   make <name>-clean
8 #   make <name>
9 #   make rules
10 #   make list
11 #   make val-<var>
12 #
13 # to add a new library:
14 #   vi configure
15 #     add inc_<name> <inc_paths>
16 #     add add_library name <lib_paths>
17 #     add probe call if the library may be already in system
18 #     fix forced_libs list: for lib in $forced_libs; do
19 #     add dependencies (order matters): for dep in <pairs>; do
20 #   vi Makefile
21 #     add pkg.<data> (pkg.x = .flags, .vars, .params)
22 #     add $(call rules,$(call std-build,<name>,<dep>...))
23 #     add deps to other call rules if they require the new library
24 #     add config enables if other libraries use the new library
25 #
26
27 include ../global_config
28 include config.mak
29 BLD := $(THIRDPARTY)/build
30
31 pkg-source=$(BLD)/$(1).source
32 pkg-config=$(BLD)/$(1).configure
33 pkg-built=$(BLD)/$(1).built
34
35 ext=$(lastword $(subst ., ,$(1)))
36 tarball=$(lastword $(wildcard src/$(1)*.tar.*))
37 unpack=$(call unpack_$(call ext,$(1)),$(1))
38 unpack_gz=tar -xzf $(1)
39 unpack_bz2=tar -xjf $(1)
40 unpack_xz=tar -xJf $(1)
41 bld_depends=$(if $(filter $(firstword $($(1))),static),$(call pkg-built,$(1)))
42 bld_path=`echo $(THIRDPARTY)/$(1)*`/$(2)
43 inc_path=$(if $(filter $(firstword $($(1))),static),-I$(call bld_path,$(1),$(2)))
44 ld_path=$(if $(filter $(firstword $($(1))),static),-L$(call bld_path,$(1),$(2)))
45
46 #$(eval $(call std-build,pkg,deps...))
47 #$(pkg.cflags) added as CFLAGS+=$(cflags) to pkg.vars
48 #$(pkg.cppflags) added as CPPFLAGS+=$(cppflags) to pkg.vars
49 #$(pkg.cfg_vars) prepended to configure
50 #$(pkg.cfg_params) appended to configure
51 #$(pkg.mak_vars) prepended to make
52 #$(pkg.mak_params) appended to make
53
54 define std-build
55 # $(1)
56 .PHONY: $(1) $(1)-configure $(1)-src $(1)-clean
57 $(1): $(call pkg-built,$(1))
58 $(1)-configure: $(call pkg-config,$(1))
59 $(1)-src: $(call pkg-source,$(1))
60 $(1)-clean:
61         rm -rf $(1)* $(BLD)/$(1).*
62
63 $(call pkg-source,$(1)):
64         $(call unpack,$(call tarball,$(1))) \
65         $(foreach pch,$(wildcard src/$(1).patch*),
66                 patch -d $(1)* -p1 < $(pch))
67         touch $$@
68
69 $(call pkg-config,$(1)): $(call pkg-source,$(1)) $(foreach dep,$(2),$(call bld_depends,$(dep)))
70         @echo "CONFIGURING $(1)"
71         cd $(1)* && \
72                 $($(1).cfg_vars) ./configure $($(1).cfg_params)
73         touch $$@
74
75 $(call pkg-built,$(1)): $(call pkg-config,$(1))
76         +$($(1).mak_vars) make -C $(1)* $($(1).mak_params)
77         touch $$@
78
79 endef
80
81 TARGETS := $(static_libs)
82
83 all:    $(TARGETS)
84
85 $(TARGETS):     $(BLD)
86
87 $(BLD):
88         mkdir $(BLD)
89
90 # vars first
91 encore.cfg_vars= true ||
92 esound.cfg_vars:= AUDIOFILE_CFLAGS="$(call inc_path,audiofile,libaudiofile) -laudiofile"
93 esound.cfg_vars+= AUDIOFILE_LIBS="$(call ld_path,audiofile,libaudiofile/.libs)"
94 esound.cfg_params= --enable-shared=no --with-pic
95 esound.ldflags="-lm -lstdc++"
96 faac.cfg_params= --enable-shared=no
97 faad2.cfg_params= --enable-shared=no
98 fdk.cfg_vars= ./autogen.sh ;
99 fdk.cfg_params= --enable-shared=no
100 fdk.mak_params= ; for f in $(call bld_path,fdk,/lib*/include); do ln -s include `dirname $$$$f`/fdk-aac ; done
101 fftw.cfg_params= --disable-fortran --enable-shared=no
102 ffmpeg.cfg_params= \
103         --enable-pthreads --enable-gpl \
104         --disable-ffserver --disable-ffplay \
105         --enable-libfaac \
106         --enable-libfdk-aac \
107         --enable-libtwolame \
108         --enable-libopenjpeg \
109         --enable-libmp3lame \
110         --enable-libvorbis \
111         --enable-libtheora \
112         --enable-libvpx \
113         --enable-libx264 \
114         --enable-libx265 \
115         --enable-nonfree \
116         --extra-cflags="\
117                 $(call inc_path,faad2,include) \
118                 $(call inc_path,faac,include) \
119                 $(call inc_path,twolame,libtwolame) \
120                 $(call inc_path,lame,include) \
121                 $(call inc_path,openjpeg,src/lib/openmj2) \
122                 $(call inc_path,libvorbis,include) \
123                 $(call inc_path,libtheora,include) \
124                 $(call inc_path,libvpx) \
125                 $(call inc_path,x264) \
126                 $(call inc_path,x265) \
127                 $(call inc_path,x265,source) \
128                 $(call inc_path,fdk,libAACdec) \
129                 $(call inc_path,fdk,libAACenc) \
130                 $(call inc_path,fdk,libSYS) \
131                 $(call inc_path,fdk,libSYS/include)" \
132         --extra-cxxflags="-D__STDC_CONSTANT_MACROS" \
133         --extra-libs="\
134                 $(call ld_path,faad2,libfaad/.libs) \
135                 $(call ld_path,faac,libfaac/.libs) \
136                 $(call ld_path,twolame,libtwolame/.libs) \
137                 $(call ld_path,lame,libmp3lame/.libs) \
138                 $(call ld_path,openjpeg,bin) \
139                 $(call ld_path,libvorbis,lib/.libs) \
140                 $(call ld_path,libtheora,lib/.libs) \
141                 $(call ld_path,libvpx) \
142                 $(call ld_path,x264) \
143                 $(call ld_path,x265) \
144                 $(call ld_path,fdk,.libs) \
145                 -ldl $(EXTRA_LIBS)" \
146         --extra-ldflags="-ldl"
147
148 audiofile.cfg_params=--enable-shared=no
149 audiofile.mak_params=LIBS="-lm -lstdc++"
150 flac.cfg_params= --enable-shared=no
151 flac.cflags="$(call inc_path,libogg,include) $(call ld_path,libogg,src/.libs)"
152 giflib.cfg_params=--enable-shared=no
153 ilmbase.cfg_params=--prefix=$(call bld_path,ilmbase,usr)
154 ilmbase.mak_params=; make -C ilmbase* install; cd $(call bld_path,ilmbase); ln -sf lib64 usr/lib
155 lame.cfg_vars= CFLAGS=-O
156 lame.cfg_params=--enable-shared=no
157 lame.mak_params= ; cd $(call bld_path,lame,include); ln -sf . lame
158 mjpegtools.cflags="$(call inc_path,libjpeg) $(call ld_path,libjpeg,.libs)"
159 mjpegtools.mak_params=; ln -s . $(call bld_path,mjpegtools,utils)/mjpegtools 
160 mjpegtools.cfg_params= --enable-shared=no
161 ladspa.mak_params=; make -C ladspa* install DESTDIR=$(call bld_path,ladspa)
162 libavc1394.cfg_vars=PKG_CONFIG_PATH=$(bld_path libraw1394)
163 libavc1394.cflags="$(inc_path libraw1394)"
164 libavc1394.ldflags="$(ld_path libraw1394,src/.libs)"
165 libavc1394.cfg_params= --enable-shared=no
166 libdv.cfg_params= --disable-gtk --enable-shared=no
167 libiec61883.cfg_vars=PKG_CONFIG_PATH=$(bld_path libraw1394)
168 libiec61883.cflags="$(inc_path libraw1394)"
169 libiec61883.ldflags="$(ld_path libraw1394,src/.libs)"
170 libiec61883.cfg_params= --enable-shared=no
171 libjpeg.cfg_params= --enable-shared=no
172 libogg.cfg_params= --enable-shared=no
173 libraw1394.cfg_params=  --enable-shared=no; ln -sf src libraw1394
174 libtheora.cfg_vars=PKG_CONFIG_PATH=$(bld_path libogg):$(bld_path libvorbis)
175 libtheora.cflags="$(inc_path libogg,include) $(inc_path libogg,src) $(inc_path libvorbis,include)"
176 libtheora.ldflags="$(ld_path libvorbis,lib/.libs) $(ld_path libogg,src/.libs)"
177 libtheora.cfg_params= --disable-examples --enable-shared=no
178 libuuid.cfg_params=--enable-shared=no
179 libvorbis.cfg_params= --disable-oggtest --enable-shared=no
180 openjpeg.cfg_vars=echo "exec cmake -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_MJ2:BOOL=ON ." > ./configure; chmod +x ./configure;
181 openjpeg.mak_params= openmj2
182 opencv.cfg_vars=echo "exec cmake -DBUILD_SHARED_LIBS:BOOL=OFF ." > ./configure; chmod +x ./configure;
183 openexr.cfg_vars=LD_LIBRARY_PATH=$(call bld_path,ilmbase,usr/lib)
184 openexr.cfg_params=--enable-shared=no
185 openexr.cfg_params+=--with-ilmbase-prefix=$(call bld_path,ilmbase,usr)
186 speech_tools.mak_params=-j1
187 twolame.cfg_params=--enable-shared=no
188 x264.cfg_params= --enable-static
189 x265.cfg_vars=echo "exec cmake source -DENABLE_SHARED=no" > ./configure; chmod +x ./configure;
190
191 # compile flag vars
192 $(foreach tgt,$(TARGETS), \
193         $(if $($(tgt).cflags),$(eval $(tgt).cfg_vars+=CFLAGS+=$($(tgt).cflags))))
194 $(foreach tgt,$(TARGETS), \
195         $(if $($(tgt).cppflags),$(eval $(tgt).cfg_vars+=CPPFLAGS+=$($(tgt).cppflags))))
196 $(foreach tgt,$(TARGETS), \
197         $(if $($(tgt).ldflags),$(eval $(tgt).cfg_vars+=LDFLAGS+=$($(tgt).ldflags))))
198
199 # build rules
200 .PHONY: rules
201 rules:
202
203 #$(eval $(call std-build,pkg,deps...))
204
205 ifeq ($(MAKECMDGOALS),rules)
206 rules=$(info $(1))
207 else
208 rules=$(eval $(1))
209 endif
210
211 $(call rules,$(call std-build,audiofile))
212 $(call rules,$(call std-build,encore))
213 $(call rules,$(call std-build,esound,audiofile))
214 $(call rules,$(call std-build,faac))
215 $(call rules,$(call std-build,faad2))
216 $(call rules,$(call std-build,fdk))
217 $(call rules,$(call std-build,ffmpeg, faad2 faac fdk twolame lame openjpeg libtheora x264 x265 libvpx))
218 $(call rules,$(call std-build,fftw))
219 $(call rules,$(call std-build,flac,libogg))
220 $(call rules,$(call std-build,giflib))
221 $(call rules,$(call std-build,ilmbase))
222 $(call rules,$(call std-build,ladspa))
223 $(call rules,$(call std-build,lame))
224 $(call rules,$(call std-build,libavc1394))
225 $(call rules,$(call std-build,libdv))
226 $(call rules,$(call std-build,libiec61883))
227 $(call rules,$(call std-build,libjpeg))
228 $(call rules,$(call std-build,libogg))
229 $(call rules,$(call std-build,libraw1394))
230 $(call rules,$(call std-build,libsndfile))
231 $(call rules,$(call std-build,libtheora, libogg libvorbis))
232 $(call rules,$(call std-build,libuuid))
233 $(call rules,$(call std-build,libvorbis))
234 $(call rules,$(call std-build,mjpegtools, libjpeg))
235 $(call rules,$(call std-build,opencv))
236 $(call rules,$(call std-build,openexr, ilmbase))
237 $(call rules,$(call std-build,openjpeg))
238 $(call rules,$(call std-build,speech_tools))
239 $(call rules,$(call std-build,tiff))
240 $(call rules,$(call std-build,twolame))
241 $(call rules,$(call std-build,x264))
242 $(call rules,$(call std-build,x265))
243 $(call rules,$(call std-build,libvpx))
244
245 # specialize festival, multiple tarballs
246 festival:
247 .PHONY: festival festival-configure festival-src
248 festival: $(call pkg-built,festival)
249 festival-configure: $(call pkg-config,festival)
250 festival-src: $(call pkg-source,festival)
251 festival-clean:
252         rm -rf festival* $(BLD)/festival.*
253
254 $(call pkg-source,festival):
255         for f in src/festival* src/festlex_* src/festvox_*; do tar -xJf $$f; done
256         touch $@
257
258 $(call pkg-config,festival): $(call pkg-source,festival) $(call pkg-built,speech_tools)
259         cd festival* && [ -f ./configure ] && \
260                 ./configure
261         touch $@
262
263 $(call pkg-built,festival): $(call pkg-config,festival)
264         make -C festival* -j1
265         touch $@
266
267 clean:
268         for f in $(thirdparty); do rm -rf $$f*; done
269         rm -rf $(BLD)
270
271 val-%:
272         @echo $($(subst val-,,$@))
273