bclistbox selection segv + other minor fixes
[goodguy/history.git] / cinelerra-5.1 / thirdparty / Makefile
1 # to see the make rules:
2 #   make rules
3 #
4 # command uses:
5 #   ./configure <static/shared>
6 #   make <name>-clean
7 #   make <name>
8 #   make rules
9 #   make list
10 #   make val-<var>
11 #
12 # to add a new library:
13 #   vi ../configure.ac
14 #     add PKG_3RD(pkg,<yes/no/auto>, <ver_basename>, <lib_paths>, <inc_paths>)
15 #     add CHECK_LIB(pkg, <syslib>, <entry_pt>, [opt libs]) if may be in system
16 #     add CHECK_HEADERS(pkg, <title>, <entry_pt>) to check for devel headers
17 #     add CHECK_WANT(<want>, <title>, [ checks ]) around tests if conditional
18 #     see openexr check for example if c++ lib
19 #     add PKG_PROVIDE(pkg,<cond>) to instance pkg if probe succeeds
20 #     add to exec > global_config if additional environment needed
21 #   vi Makefile
22 #     add pkg.<data> (pkg.x = .flags, .vars, .params)
23 #     add $(call rules,$(call std-build,<name>,<dep>...))
24 #     add deps to other call rules if they require the new library
25 #     add config enables if other libraries use the new library
26 #
27
28 TOPDIR ?= $(CURDIR)/..
29 include $(TOPDIR)/global_config
30 -include $(TOPDIR)/cin_config
31 BLD := $(THIRDPARTY)/build
32
33 # package build flags, if needed
34 # need frame pointer for debugs and helps with profiling
35 # NOTE: the trailing blank is MANDITORY or the builds fail
36 # due to bugs in the build scripts from auto*
37 CFLAGS_ ?= -g -O2 -fno-omit-frame-pointer
38 CFLAGS ?= $(CFLAGS_) 
39 LDFLAGS += $(LDFLAGS_) 
40 CXXFLAGS += $(CXXFLAGS_) 
41
42 pkg-source=$(BLD)/$(1).source
43 pkg-config=$(BLD)/$(1).configure
44 pkg-built=$(BLD)/$(1).built
45
46 ext=$(lastword $(subst ., ,$(1)))
47 tarball=$(lastword $(wildcard src/$(1)*.tar.*))
48 unpack=$(call unpack_$(call ext,$(1)),$(1))
49 unpack_gz=tar -xzf $(1)
50 unpack_bz2=tar -xjf $(1)
51 unpack_xz=tar -xJf $(1)
52 bld_depends=$(if $(ver_$(1)),$(call pkg-built,$(1)))
53 bld_path=$(ver_$(1))/$(2)
54 inc_path=$(inc_$(1))
55 ld_path=$(if $(ver_$(1)),-L$(call bld_path,$(1),$(2)))
56
57 #$(eval $(call std-build,pkg,deps...))
58 #$(pkg.cflags) added as CFLAGS+=$(cflags) to pkg.vars
59 #$(pkg.cppflags) added as CPPFLAGS+=$(cppflags) to pkg.vars
60 #$(pkg.cfg_vars) prepended to configure
61 #$(pkg.cfg_params) appended to configure
62 #$(pkg.mak_vars) prepended to make
63 #$(pkg.mak_params) appended to make
64
65 define std-build
66 # $(1)
67 .PHONY: $(1) $(1)-configure $(1)-src $(1)-clean
68 $(1): $(call pkg-built,$(1))
69 $(1)-configure: $(call pkg-config,$(1))
70 $(1)-src: $(call pkg-source,$(1))
71 $(1)-clean:
72         rm -rf $(1)* $(BLD)/$(1).*
73
74 $(call pkg-source,$(1)):
75         $(call unpack,$(call tarball,$(1))) \
76         $(foreach pch,$(wildcard src/$(1).patch*),
77                 patch -d $(1)* -p1 < $(pch))
78         touch $$@
79
80 $(call pkg-config,$(1)): $(call pkg-source,$(1)) $(foreach dep,$(2),$(call bld_depends,$(dep)))
81         @echo "CONFIGURING $(1)"
82         cd $(1)* && \
83                 $($(1).cfg_vars) $(CFG_VARS) ./configure $($(1).cfg_params) $(CFG_PARAMS)
84         touch $$@
85
86 $(call pkg-built,$(1)): $(call pkg-config,$(1))
87         +$($(1).mak_vars) $(MAK_VARS) $(MAKE) -C $(1)* $($(1).mak_params) $(MAK_PARAMS)
88         touch $$@
89
90 endef
91
92 TARGETS := $(static_blds)
93
94 all:    $(TARGETS)
95
96 $(TARGETS):     $(BLD)
97
98 $(BLD):
99         mkdir $(BLD)
100
101 # vars first
102 encore.cfg_vars= true ||
103 esound.cfg_vars:= AUDIOFILE_CFLAGS="$(call inc_path,audiofile,libaudiofile) -laudiofile"
104 esound.cfg_vars+= AUDIOFILE_LIBS="$(call ld_path,audiofile,libaudiofile/.libs)"
105 esound.cfg_params= --enable-shared=no --with-pic
106 esound.mak_vars+= CFLAGS="" 
107 esound.ldflags=" -lm -lstdc++"
108 faac.cfg_params= --enable-shared=no
109 faad2.cfg_params= --enable-shared=no
110 fdk.cfg_vars= ./autogen.sh ;
111 fdk.cfg_params= --enable-shared=no
112 fdk.mak_params= ; for f in $(call bld_path,fdk,/lib*/include); do ln -s . $$$$f/fdk-aac; done
113 fftw.cfg_params= --disable-fortran --enable-shared=no
114 ffmpeg.cfg_params= \
115         --enable-pthreads --enable-gpl \
116         --disable-ffserver --disable-ffplay \
117         --disable-vaapi \
118         --enable-libfaac \
119         --enable-libfdk-aac \
120         --enable-libtwolame \
121         --enable-libopenjpeg \
122         --enable-libmp3lame \
123         --enable-libvorbis \
124         --enable-libtheora \
125         --enable-libvpx \
126         --enable-libx264 \
127         --enable-libx265 \
128         --enable-nonfree \
129         --extra-cflags="\
130                 $(call inc_path,faad2,include) \
131                 $(call inc_path,faac,include) \
132                 $(call inc_path,twolame,libtwolame) \
133                 $(call inc_path,lame,include) \
134                 $(call inc_path,openjpeg,src/lib/openjp2) \
135                 $(call inc_path,libvorbis,include) \
136                 $(call inc_path,libtheora,include) \
137                 $(call inc_path,libvpx) \
138                 $(call inc_path,x264) \
139                 $(call inc_path,x265) \
140                 $(call inc_path,x265,source) \
141                 $(call inc_path,fdk,libAACdec) \
142                 $(call inc_path,fdk,libAACenc) \
143                 $(call inc_path,fdk,libSYS) \
144                 $(call inc_path,fdk,libSYS/include)" \
145         --extra-cxxflags="-D__STDC_CONSTANT_MACROS" \
146         --extra-libs="\
147                 $(call ld_path,faad2,libfaad/.libs) \
148                 $(call ld_path,faac,libfaac/.libs) \
149                 $(call ld_path,twolame,libtwolame/.libs) \
150                 $(call ld_path,lame,libmp3lame/.libs) \
151                 $(call ld_path,openjpeg,bin) \
152                 $(call ld_path,libvorbis,lib/.libs) \
153                 $(call ld_path,libtheora,lib/.libs) \
154                 $(call ld_path,libvpx) \
155                 $(call ld_path,x264) \
156                 $(call ld_path,x265) \
157                 $(call ld_path,fdk,.libs) \
158                 $(EXTRA_LIBS)" $(FFMPEG_EXTRA_CFG) \
159
160 cmake_config=echo "exec cmake \$$$$@ $(1)" > ./configure; chmod +x ./configure;
161 a52dec.mak_params?= ; cd $(call bld_path,a52dec,include); ln -sf . a52dec
162 a52dec.cfg_vars?= CFLAGS+=" -U__FreeBSD__"
163 audiofile.cfg_params?=--enable-shared=no
164 audiofile.mak_params?=LIBS="-lm -lstdc++"
165 flac.cfg_params?= --enable-shared=no
166 flac.cflags?="$(call inc_path,libogg,include) $(call ld_path,libogg,src/.libs)"
167 giflib.cfg_params?=--enable-shared=no
168 ilmbase.cfg_params?=--prefix=$(call bld_path,ilmbase,usr)
169 ilmbase.mak_params?=; $(MAKE) -C ilmbase* install; cd $(call bld_path,ilmbase); ln -sf lib64 usr/lib
170 lame.cfg_vars?= CFLAGS+=" -O"
171 lame.cfg_params?=--enable-shared=no
172 lame.mak_params?= ; cd $(call bld_path,lame,include); ln -sf . lame
173 mjpegtools.cflags?="$(call inc_path,libjpeg) $(call ld_path,libjpeg,.libs)"
174 mjpegtools.mak_params?=; ln -s . $(call bld_path,mjpegtools,utils)/mjpegtools 
175 mjpegtools.cfg_params?= --enable-shared=no
176 ladspa.mak_params?=; $(MAKE) -C ladspa* install DESTDIR=$(call bld_path,ladspa)
177 libavc1394.cfg_vars?=PKG_CONFIG_PATH=$(call bld_path,libraw1394)
178 libavc1394.cflags?="$(call inc_path,libraw1394)"
179 libavc1394.ldflags?="$(call ld_path,libraw1394,src/.libs)"
180 libavc1394.cfg_params?= --enable-shared=no
181 libavc1394.mak_params?=; cd $(call bld_path,libavc1394); ln -sf ../librom1394/rom1394.h libavc1394/.
182 libdv.cfg_params?= --disable-gtk --enable-shared=no
183 libiec61883.cfg_vars?=PKG_CONFIG_PATH=$(call bld_path,libraw1394)
184 libiec61883.cflags?="$(call inc_path,libraw1394)"
185 libiec61883.ldflags?="$(call ld_path,libraw1394,src/.libs)"
186 libiec61883.cfg_params?= --enable-shared=no
187 libjpeg.cfg_params?= --enable-shared=no
188 libogg.cfg_params?= --enable-shared=no
189 libraw1394.cfg_params?=  --enable-shared=no; ln -sf src libraw1394
190 libtheora.cfg_vars?=PKG_CONFIG_PATH=$(call bld_path,libogg):$(call bld_path,libvorbis)
191 libtheora.cflags?="$(call inc_path,libogg,include) $(call inc_path,libogg,src) $(call inc_path,libvorbis,include)"
192 libtheora.ldflags?="$(call ld_path,libvorbis,lib/.libs) $(call ld_path,libogg,src/.libs)"
193 libtheora.cfg_params?= --disable-examples --enable-shared=no
194 libuuid.cfg_params?=--enable-shared=no
195 libvorbis.cfg_params?= --disable-oggtest --enable-shared=no
196 openjpeg.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
197 openjpeg.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
198 openjpeg.cfg_vars?=$(call cmake_config,.)
199 openjpeg.mak_params?= ; cd $(call bld_path,openjpeg,src/lib/openjp2); ln -sf . openjpeg-2.1
200 opencv.cfg_vars?=$(call cmake_config,.)
201 opencv.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
202 openexr.cfg_vars?=LD_LIBRARY_PATH=$(call bld_path,ilmbase,usr/lib)
203 openexr.cfg_params?=--enable-shared=no --with-ilmbase-prefix=$(call bld_path,ilmbase,usr)
204 speech_tools.mak_params?=-j1
205 twolame.cfg_params?=--enable-shared=no
206 x264.cfg_params?= --enable-static
207 x265.cfg_vars?=$(call cmake_config,source)
208 x265.cfg_params?= -DENABLE_SHARED=no
209
210 # compile flag vars
211 $(foreach tgt,$(TARGETS), \
212         $(if $($(tgt).cflags),$(eval $(tgt).cfg_vars+=CFLAGS+=$($(tgt).cflags))))
213 $(foreach tgt,$(TARGETS), \
214         $(if $($(tgt).cppflags),$(eval $(tgt).cfg_vars+=CPPFLAGS+=$($(tgt).cppflags))))
215 $(foreach tgt,$(TARGETS), \
216         $(if $($(tgt).ldflags),$(eval $(tgt).cfg_vars+=LDFLAGS+=$($(tgt).ldflags))))
217
218 # build rules
219 .PHONY: rules
220 rules:
221
222 #$(eval $(call std-build,pkg,deps...))
223
224 ifeq ($(MAKECMDGOALS),rules)
225 rules=$(info $(1))
226 else
227 rules=$(eval $(1))
228 endif
229
230 $(call rules,$(call std-build,a52dec))
231 $(call rules,$(call std-build,audiofile))
232 $(call rules,$(call std-build,encore))
233 $(call rules,$(call std-build,esound,audiofile))
234 $(call rules,$(call std-build,faac))
235 $(call rules,$(call std-build,faad2))
236 $(call rules,$(call std-build,fdk))
237 $(call rules,$(call std-build,ffmpeg, faad2 faac fdk twolame lame openjpeg libtheora x264 x265 libvpx))
238 $(call rules,$(call std-build,fftw))
239 $(call rules,$(call std-build,flac,libogg))
240 $(call rules,$(call std-build,giflib))
241 $(call rules,$(call std-build,ilmbase))
242 $(call rules,$(call std-build,ladspa))
243 $(call rules,$(call std-build,lame))
244 $(call rules,$(call std-build,libavc1394,libraw1394))
245 $(call rules,$(call std-build,libdv))
246 $(call rules,$(call std-build,libiec61883))
247 $(call rules,$(call std-build,libjpeg))
248 $(call rules,$(call std-build,libogg))
249 $(call rules,$(call std-build,libraw1394))
250 $(call rules,$(call std-build,libsndfile))
251 $(call rules,$(call std-build,libtheora, libogg libvorbis))
252 $(call rules,$(call std-build,libuuid))
253 $(call rules,$(call std-build,libvorbis))
254 $(call rules,$(call std-build,mjpegtools, libjpeg))
255 $(call rules,$(call std-build,opencv))
256 $(call rules,$(call std-build,openexr, ilmbase))
257 $(call rules,$(call std-build,openjpeg))
258 $(call rules,$(call std-build,speech_tools))
259 $(call rules,$(call std-build,tiff))
260 $(call rules,$(call std-build,twolame))
261 $(call rules,$(call std-build,x264))
262 $(call rules,$(call std-build,x265))
263 $(call rules,$(call std-build,libvpx))
264
265 # specialize festival, multiple tarballs
266 festival:
267 .PHONY: festival festival-configure festival-src
268 festival: $(call pkg-built,festival)
269 festival-configure: $(call pkg-config,festival)
270 festival-src: $(call pkg-source,festival)
271 festival-clean:
272         rm -rf festival* $(BLD)/festival.*
273
274 $(call pkg-source,festival):
275         for f in src/festival* src/festlex_* src/festvox_*; do tar -xJf $$f; done
276         touch $@
277
278 $(call pkg-config,festival): $(call pkg-source,festival) $(call pkg-built,speech_tools)
279         cd festival* && [ -f ./configure ] && \
280                 ./configure
281         touch $@
282
283 $(call pkg-built,festival): $(call pkg-config,festival)
284         $(MAKE) -C festival* -j1
285         touch $@
286
287 clean:
288         for f in $(static_pkgs); do rm -rf $$f*; done
289         rm -rf $(BLD)
290
291 install:
292         cp -a $(ver_mjpegtools)/mpeg2enc/mpeg2enc $(BINDIR)/.
293         cp -a $(ver_mjpegtools)/mplex/mplex $(BINDIR)/.
294
295 val-%:
296         @echo $($(subst val-,,$@))
297