1 # to see the make rules:
10 # to add a new library:
12 # add PKG_3RD(pkg,<yes/no/auto>, <ver_basename>, <lib_paths>, <inc_paths>)
13 # add CHECK_LIB(pkg, <syslib>, <entry_pt>, [opt libs]) if may be in system
14 # add CHECK_HEADERS(pkg, <title>, <entry_pt>) to check for devel headers
15 # add CHECK_WANT(<want>, <title>, [ checks ]) around tests if conditional
16 # see openexr check for example if c++ lib
17 # add PKG_PROVIDE(pkg,<cond>) to instance pkg if probe succeeds
18 # add to exec > global_config if additional environment needed
20 # add pkg.<data> (pkg.x = .flags, .vars, .params)
21 # add $(call rules,$(call std-build,<name>,<dep>...))
22 # add deps to other call rules if they require the new library
23 # add config enables if other libraries use the new library
26 TOPDIR ?= $(CURDIR)/..
27 include $(TOPDIR)/global_config
28 -include $(TOPDIR)/cin_config
29 BLD := $(THIRDPARTY)/build
31 ifneq ($(WANT_CIN_3RDPARTY),no)
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
39 LDFLAGS += $(LDFLAGS_)
40 CXXFLAGS += $(CXXFLAGS_)
42 pkg-source=$(BLD)/$(1).source
43 pkg-config=$(BLD)/$(1).configure
44 pkg-built=$(BLD)/$(1).built
46 ext=$(lastword $(subst ., ,$(1)))
47 tarball=$(if $($(1).git),$(1).git,$(lastword $(sort $(wildcard src/$(1)*.tar.*))))
48 unpack=$(call unpack_$(call ext,$(1)),$(1))
49 unpack_git=git clone $($(1)) $(1)
50 unpack_gz=tar -xzf $(1)
51 unpack_bz2=tar -xjf $(1)
52 unpack_xz=tar -xJf $(1)
53 bld_depends=$(if $(ver_$(1)),$(call pkg-built,$(1)))
54 bld_path=$(ver_$(1))/$(2)
55 if_pkg=$(if $(ver_$(1)),$(2))
56 inc_path=$(call if_pkg,$(1),$(inc_$(1)))
57 ld_path=$(call if_pkg,$(1),-L$(call bld_path,$(1),$(2)) $(lib_$(1)))
59 #$(eval $(call std-build,pkg,deps...))
60 #$(pkg.cflags) added as CFLAGS+=$(cflags) to pkg.vars
61 #$(pkg.cppflags) added as CPPFLAGS+=$(cppflags) to pkg.vars
62 #$(pkg.cfg_vars) prepended to configure
63 #$(pkg.cfg_params) appended to configure
64 #$(pkg.mak_vars) prepended to make
65 #$(pkg.mak_params) appended to make
69 .PHONY: $(1) $(1)-configure $(1)-src $(1)-clean
70 $(1): $(call pkg-built,$(1))
71 $(1)-configure: $(call pkg-config,$(1))
72 $(1)-src: $(call pkg-source,$(1))
74 rm -rf $(1)* $(BLD)/$(1).*
76 $(call pkg-source,$(1)):
77 $(call unpack,$(call tarball,$(1))) \
78 $(foreach pch,$(sort $(wildcard src/$(notdir $(ver_$(1))).patch*)),
79 patch -d $(1)* -p1 < $(pch))
82 $(call pkg-config,$(1)): $(call pkg-source,$(1)) $(foreach dep,$(2),$(call bld_depends,$(dep)))
83 @echo "CONFIGURING $(1)"
85 $($(1).cfg_vars) $(CFG_VARS) ./configure $($(1).cfg_params) $(CFG_PARAMS)
88 $(call pkg-built,$(1)): $(call pkg-config,$(1))
89 +$($(1).mak_vars) $(MAK_VARS) $(MAKE) -C $(1)* $($(1).mak_params) $(MAK_PARAMS)
94 TARGETS := $(static_blds)
104 encore.cfg_vars= true ||
105 esound.cfg_vars:= AUDIOFILE_CFLAGS="$(call inc_path,audiofile,libaudiofile) -laudiofile"
106 esound.cfg_vars+= AUDIOFILE_LIBS="$(call ld_path,audiofile,libaudiofile/.libs)"
107 esound.cfg_params= --enable-shared=no --with-pic
108 esound.mak_vars+= CFLAGS=""
109 esound.ldflags=" -lm -lstdc++"
110 #fdk.cfg_vars= ./autogen.sh ; CFLAGS+=" -Wno-narrowing" CXXFLAGS+=" -Wno-narrowing"
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
115 --enable-pthreads --enable-gpl \
116 --disable-ffplay --disable-vaapi \
117 $(call if_pkg,fdk,--enable-libfdk-aac) \
118 $(call if_pkg,twolame,--enable-libtwolame) \
119 $(call if_pkg,openjpeg,--enable-libopenjpeg) \
120 $(call if_pkg,lame,--enable-libmp3lame) \
121 $(call if_pkg,libvorbis,--enable-libvorbis) \
122 $(call if_pkg,libtheora,--enable-libtheora) \
123 $(call if_pkg,libvpx,--enable-libvpx) \
124 $(call if_pkg,x264,--enable-libx264) \
125 $(call if_pkg,x265,--enable-libx265) \
128 $(call inc_path,twolame,libtwolame) \
129 $(call inc_path,lame,include) \
130 $(call inc_path,openjpeg,src/lib/openjp2) \
131 $(call inc_path,libogg,include) \
132 $(call inc_path,opus,include) \
133 $(call inc_path,libvorbis,include) \
134 $(call inc_path,libtheora,include) \
135 $(call inc_path,libvpx) \
136 $(call inc_path,x264) \
137 $(call inc_path,x265) \
138 $(call inc_path,x265,source) \
139 $(call inc_path,fdk,libAACdec) \
140 $(call inc_path,fdk,libAACenc) \
141 $(call inc_path,fdk,libSYS) \
142 $(call inc_path,fdk,libSYS/include)" \
143 --extra-cxxflags="-D__STDC_CONSTANT_MACROS" \
145 --extra-libs="-Wl,--start-group \
146 $(call ld_path,twolame,libtwolame/.libs) \
147 $(call ld_path,lame,libmp3lame/.libs) \
148 $(call ld_path,openjpeg,bin) \
149 $(call ld_path,opus,.libs) \
150 $(call ld_path,libogg,lib/.libs) \
151 $(call ld_path,libvorbis,lib/.libs) \
152 $(call ld_path,libtheora,lib/.libs) \
153 $(call ld_path,libvpx) \
154 $(call ld_path,x264) \
155 $(call ld_path,x265) \
156 $(call ld_path,fdk,.libs) \
157 -Wl,--end-group -lm -lstdc++ -pthread \
158 $(EXTRA_LIBS)" $(FFMPEG_EXTRA_CFG) \
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__ $(call inc_path,djbfft)" LIBS+=" $(call ld_path,djbfft)"
163 a52dec.cfg_params?=--enable-djbfft
164 djbfft.cfg_vars?=echo "$(call bld_path,djbfft)" > conf-home; \
165 (CFLAGS="$(CFLAGS)"; $(CFG_VARS)$(if $(CFG_VARS),; )echo "$(CC) $$$$CFLAGS") > conf-cc; \
166 echo > ./configure; chmod +x ./configure;
167 djbfft.mak_params?=; cd $(call bld_path,djbfft); ln -sf djbfft.a libdjbfft.a
168 audiofile.cfg_params?=--enable-shared=no
169 audiofile.mak_params?=LIBS="-lm -lstdc++"
170 flac.cfg_params?= --enable-shared=no
171 flac.cflags?="$(call inc_path,libogg,include) $(call ld_path,libogg,src/.libs)"
172 giflib.cfg_params?=--enable-shared=no
173 ilmbase.cfg_vars= CFLAGS+=" -Wno-narrowing" CXXFLAGS+=" -Wno-narrowing"
174 ilmbase.cfg_params?=--prefix=$(call bld_path,ilmbase,usr)
175 ilmbase.mak_params?=; $(MAKE) -C ilmbase* install; cd $(call bld_path,ilmbase); ln -sf lib64 usr/lib
176 lame.cfg_vars?= CFLAGS+=" -O"
177 lame.cfg_params?=--enable-shared=no
178 lame.mak_params?= ; cd $(call bld_path,lame,include); ln -sf . lame
179 mjpegtools.cflags?="$(call inc_path,libjpeg) $(call ld_path,libjpeg,.libs)"
180 mjpegtools.mak_params?=; ln -s . $(call bld_path,mjpegtools,utils)/mjpegtools
181 mjpegtools.cfg_params?= --enable-shared=no --without-libsdl
182 ladspa.cfg_vars?= CFLAGS+=' -Dinline="" '
183 ladspa.mak_params?=; $(MAKE) -C ladspa* install DESTDIR=$(call bld_path,ladspa)
184 libavc1394.cfg_vars?=PKG_CONFIG_PATH=$(call bld_path,libraw1394)
185 libavc1394.cflags?="$(call inc_path,libraw1394)"
186 libavc1394.ldflags?="$(call ld_path,libraw1394,src/.libs)"
187 libavc1394.cfg_params?= --enable-shared=no
188 libavc1394.mak_params?=; cd $(call bld_path,libavc1394); ln -sf ../librom1394/rom1394.h libavc1394/.
189 libdv.cfg_params?= --disable-gtk --enable-shared=no
190 libiec61883.cfg_vars?=PKG_CONFIG_PATH=$(call bld_path,libraw1394)
191 libiec61883.cflags?="$(call inc_path,libraw1394)"
192 libiec61883.ldflags?="$(call ld_path,libraw1394,src/.libs)"
193 libiec61883.cfg_params?= --enable-shared=no
194 libiec61883.mak_params?=; cd $(call bld_path,libiec61883,src); ln -sf . libiec61883
195 libjpeg.cfg_params?= --enable-shared=no
196 libogg.cfg_params?= --enable-shared=no
197 libraw1394.cfg_params?= --enable-shared=no; ln -sf src libraw1394
198 libtheora.cfg_vars?=PKG_CONFIG_PATH=$(call bld_path,libogg):$(call bld_path,libvorbis)
199 libtheora.cflags?="$(call inc_path,libogg,include) $(call inc_path,libogg,src) $(call inc_path,libvorbis,include)"
200 libtheora.ldflags?="$(call ld_path,libvorbis,lib/.libs) $(call ld_path,libogg,src/.libs)"
201 libtheora.cfg_params?= --disable-examples --disable-spec --enable-shared=no
202 libuuid.cfg_params?=--enable-shared=no
203 libvorbis.cfg_params?= --disable-oggtest --enable-shared=no
204 openjpeg.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
205 openjpeg.cfg_vars?=$(call cmake_config,.)
206 openjpeg.mak_params?= ; cd $(call bld_path,openjpeg,src/lib/openjp2); ln -sf . openjpeg-2.1
207 opencv.cfg_vars?=$(call cmake_config,.)
208 opencv.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
209 openexr.cfg_vars?=LD_LIBRARY_PATH=$(call bld_path,ilmbase,usr/lib)
210 openexr.cfg_params?=--enable-shared=no --with-ilmbase-prefix=$(call bld_path,ilmbase,usr)
211 speech_tools.mak_params?=-j1
212 twolame.cfg_params?=--enable-shared=no
213 x264.cfg_params?= --enable-static --enable-pic
214 x265.cfg_vars?=$(call cmake_config,source)
215 x265.cfg_params?= -DENABLE_SHARED=no
216 libvpx.cfg_params?= --enable-pic
219 pkg_cfg=$(call bld_path,$(1),usr/local/lib/pkgconfig):
220 LV2_PKGCFG:=$(subst : ,:,$(foreach p,lv2 serd sord sratom lilv suil,$(call pkg_cfg,$(p))))
224 $(1).cfg_vars+=echo 'exec ./waf configure "$(DS)@"' > ./configure; chmod +x \
225 ./configure; PKG_CONFIG_PATH=$(LV2_PKGCFG) LD_LIBRARY_PATH=$(LV2_LIBPATH)
227 CFLAGS="-I$(call bld_path,lv2) $(foreach f,$(2), $(call inc_path,$(f))) -fPIC "\
228 LDFLAGS="-lm $(foreach f,$(2), $(call ld_path,$(f),usr/local/lib)) "
229 $(1).mak_vars=(echo "all:"; echo " ./waf -v build") > $(call bld_path,$(1),Makefile);
230 $(1).mak_params+=; ( cd $(1)*; ./waf install --destdir=$(call bld_path,$(1)) )
233 SYS_LIB:=$(notdir $(lastword $(wildcard /usr/lib /usrlib32 /usr/lib64)))
234 SYS_LV2:=$(lastword $(wildcard /usr/$(SYS_LIB)/lv2 /usr/local/$(SYS_LIB)/lv2))
235 $(if $(SYS_LV2),,$(eval SYS_LV2:=/usr/$(SYS_LIB)/lv2))
236 lv2.cfg_params?= --lv2dir=$(SYS_LV2)
237 SYS_LV2_PATH:=/usr/$(SYS_LIB)/lv2: /usr/local/$(SYS_LIB)/lv2:
238 DFT_LV2_PATH:= /usr/lib64/lv2: /usr/lib/lv2: /usr/local/lib64/lv2: /usr/local/lib/lv2:
239 LV2_PATH:=$(subst : ,:,$(SYS_LV2_PATH)$(filter-out $(SYS_LV2_PATH),$(DFT_LV2_PATH)))
240 lilv.cfg_params?= --static --default-lv2-path=$(LV2_PATH)
241 sratom.cfg_params?= --static --no-shared
242 serd.cfg_params?= --static --no-shared
243 sord.cfg_params?= --static --no-shared
244 lilv.cfg_params?= --static --dyn-manifest
245 suil.cfg_params?= --static --no-qt
247 $(eval $(call waf-setup,lv2))
248 $(eval $(call waf-setup,serd))
249 $(eval $(call waf-setup,sord, serd))
250 $(eval $(call waf-setup,sratom, serd sord lv2))
251 $(eval $(call waf-setup,lilv, lv2 sratom serd sord))
252 $(eval $(call waf-setup,suil, lv2))
254 # add softlinks for legacy paths
255 waf_link=$(1).mak_params+=; (cd $(1)*; ln -s $(1)-0/$(1) usr/local/include/.)
256 $(foreach p,sratom serd sord lilv suil,$(eval $(call waf_link,$(p))))
259 $(foreach tgt,$(TARGETS), \
260 $(if $($(tgt).cflags),$(eval $(tgt).cfg_vars+=CFLAGS+=$($(tgt).cflags))))
261 $(foreach tgt,$(TARGETS), \
262 $(if $($(tgt).cppflags),$(eval $(tgt).cfg_vars+=CPPFLAGS+=$($(tgt).cppflags))))
263 $(foreach tgt,$(TARGETS), \
264 $(if $($(tgt).ldflags),$(eval $(tgt).cfg_vars+=LDFLAGS+=$($(tgt).ldflags))))
270 #$(eval $(call std-build,pkg,deps...))
272 ifeq ($(MAKECMDGOALS),rules)
278 $(call rules,$(call std-build,a52dec,djbfft))
279 $(call rules,$(call std-build,djbfft))
280 $(call rules,$(call std-build,audiofile))
281 $(call rules,$(call std-build,encore))
282 $(call rules,$(call std-build,esound,audiofile))
283 $(call rules,$(call std-build,fdk))
284 $(call rules,$(call std-build,ffmpeg, fdk twolame lame openjpeg opus libtheora x264 x265 libvpx))
285 $(call rules,$(call std-build,fftw))
286 $(call rules,$(call std-build,flac,libogg))
287 $(call rules,$(call std-build,giflib))
288 $(call rules,$(call std-build,ilmbase))
289 $(call rules,$(call std-build,ladspa))
290 $(call rules,$(call std-build,lame))
291 $(call rules,$(call std-build,libavc1394,libraw1394))
292 $(call rules,$(call std-build,libdv))
293 $(call rules,$(call std-build,libiec61883,libraw1394))
294 $(call rules,$(call std-build,libjpeg))
295 $(call rules,$(call std-build,libogg))
296 $(call rules,$(call std-build,libraw1394))
297 $(call rules,$(call std-build,libsndfile))
298 $(call rules,$(call std-build,libtheora, libogg libvorbis))
299 $(call rules,$(call std-build,libuuid))
300 $(call rules,$(call std-build,libvorbis))
301 $(call rules,$(call std-build,mjpegtools, libjpeg))
302 $(call rules,$(call std-build,opencv))
303 $(call rules,$(call std-build,openexr, ilmbase))
304 $(call rules,$(call std-build,openjpeg))
305 $(call rules,$(call std-build,opus))
306 $(call rules,$(call std-build,speech_tools))
307 $(call rules,$(call std-build,tiff))
308 $(call rules,$(call std-build,twolame))
309 $(call rules,$(call std-build,x264))
310 $(call rules,$(call std-build,x265))
311 $(call rules,$(call std-build,libvpx))
312 $(call rules,$(call std-build,lv2))
313 $(call rules,$(call std-build,serd))
314 $(call rules,$(call std-build,sord, serd))
315 $(call rules,$(call std-build,sratom, serd sord lv2))
316 $(call rules,$(call std-build,lilv, lv2 sratom serd sord))
317 $(call rules,$(call std-build,suil, lv2))
319 # specialize festival, multiple tarballs
321 .PHONY: festival festival-configure festival-src
322 festival: $(call pkg-built,festival)
323 festival-configure: $(call pkg-config,festival)
324 festival-src: $(call pkg-source,festival)
326 rm -rf festival* $(BLD)/festival.*
328 $(call pkg-source,festival):
329 for f in src/festival* src/festlex_* src/festvox_*; do tar -xJf $$f; done
332 $(call pkg-config,festival): $(call pkg-source,festival) $(call pkg-built,speech_tools)
333 cd festival* && [ -f ./configure ] && \
337 $(call pkg-built,festival): $(call pkg-config,festival)
338 $(MAKE) -C festival* -j1
342 for f in $(static_pkgs); do rm -rf $$f*; done
346 cp -a $(ver_mjpegtools)/mpeg2enc/mpeg2enc $(BINDIR)/.
347 cp -a $(ver_mjpegtools)/mplex/mplex $(BINDIR)/.
349 # not WANT_CIN_3RDPARTY
356 @echo $($(subst val-,,$@))