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 fftw.cfg_params= --disable-fortran --enable-shared=no
112 --enable-pthreads --enable-gpl \
113 --disable-ffplay --disable-vaapi \
114 $(call if_pkg,twolame,--enable-libtwolame) \
115 $(call if_pkg,openjpeg,--enable-libopenjpeg) \
116 $(call if_pkg,lame,--enable-libmp3lame) \
117 $(call if_pkg,libvorbis,--enable-libvorbis) \
118 $(call if_pkg,libtheora,--enable-libtheora) \
119 $(call if_pkg,libvpx,--enable-libvpx) \
120 $(call if_pkg,x264,--enable-libx264) \
121 $(call if_pkg,x265,--enable-libx265) \
123 $(call inc_path,twolame,libtwolame) \
124 $(call inc_path,lame,include) \
125 $(call inc_path,openjpeg,src/lib/openjp2) \
126 $(call inc_path,libogg,include) \
127 $(call inc_path,opus,include) \
128 $(call inc_path,libvorbis,include) \
129 $(call inc_path,libtheora,include) \
130 $(call inc_path,libvpx) \
131 $(call inc_path,x264) \
132 $(call inc_path,x265) \
133 $(call inc_path,x265,source)" \
134 --extra-cxxflags="-D__STDC_CONSTANT_MACROS" \
136 --extra-libs="-Wl,--start-group \
137 $(call ld_path,twolame,libtwolame/.libs) \
138 $(call ld_path,lame,libmp3lame/.libs) \
139 $(call ld_path,openjpeg,bin) \
140 $(call ld_path,opus,.libs) \
141 $(call ld_path,libogg,lib/.libs) \
142 $(call ld_path,libvorbis,lib/.libs) \
143 $(call ld_path,libtheora,lib/.libs) \
144 $(call ld_path,libvpx) \
145 $(call ld_path,x264) \
146 $(call ld_path,x265) \
147 -Wl,--end-group -lm -lstdc++ -pthread \
148 $(EXTRA_LIBS)" $(FFMPEG_EXTRA_CFG) \
150 cmake_config=echo "exec cmake \$$$$@ $(1)" > ./configure; chmod +x ./configure;
151 a52dec.mak_params?= ; cd $(call bld_path,a52dec,include); ln -sf . a52dec
152 a52dec.cfg_vars?= CFLAGS+=" -U__FreeBSD__ $(call inc_path,djbfft)" LIBS+=" $(call ld_path,djbfft)"
153 a52dec.cfg_params?=--enable-djbfft
154 djbfft.cfg_vars?=echo "$(call bld_path,djbfft)" > conf-home; \
155 (CFLAGS="$(CFLAGS)"; $(CFG_VARS)$(if $(CFG_VARS),; )echo "$(CC) $$$$CFLAGS") > conf-cc; \
156 echo > ./configure; chmod +x ./configure;
157 djbfft.mak_params?=; cd $(call bld_path,djbfft); ln -sf djbfft.a libdjbfft.a
158 audiofile.cfg_params?=--enable-shared=no
159 audiofile.mak_params?=LIBS="-lm -lstdc++"
160 flac.cfg_params?= --enable-shared=no
161 flac.cflags?="$(call inc_path,libogg,include) $(call ld_path,libogg,src/.libs)"
162 giflib.cfg_params?=--enable-shared=no
163 ilmbase.cfg_vars= CFLAGS+=" -Wno-narrowing" CXXFLAGS+=" -Wno-narrowing"
164 ilmbase.cfg_params?=--prefix=$(call bld_path,ilmbase,usr)
165 ilmbase.mak_params?=; $(MAKE) -C ilmbase* install; cd $(call bld_path,ilmbase); ln -sf lib64 usr/lib
166 lame.cfg_vars?= CFLAGS+=" -O"
167 lame.cfg_params?=--enable-shared=no
168 lame.mak_params?= ; cd $(call bld_path,lame,include); ln -sf . lame
169 mjpegtools.cflags?="$(call inc_path,libjpeg) $(call ld_path,libjpeg,.libs)"
170 mjpegtools.mak_params?=; ln -s . $(call bld_path,mjpegtools,utils)/mjpegtools
171 mjpegtools.cfg_params?= --enable-shared=no --without-libsdl
172 ladspa.cfg_vars?= CFLAGS+=' -Dinline="" '
173 ladspa.mak_params?=; $(MAKE) -C ladspa* install DESTDIR=$(call bld_path,ladspa)
174 libavc1394.cfg_vars?=PKG_CONFIG_PATH=$(call bld_path,libraw1394)
175 libavc1394.cflags?="$(call inc_path,libraw1394)"
176 libavc1394.ldflags?="$(call ld_path,libraw1394,src/.libs)"
177 libavc1394.cfg_params?= --enable-shared=no
178 libavc1394.mak_params?=; cd $(call bld_path,libavc1394); ln -sf ../librom1394/rom1394.h libavc1394/.
179 libdv.cfg_params?= --disable-gtk --enable-shared=no
180 libiec61883.cfg_vars?=PKG_CONFIG_PATH=$(call bld_path,libraw1394)
181 libiec61883.cflags?="$(call inc_path,libraw1394)"
182 libiec61883.ldflags?="$(call ld_path,libraw1394,src/.libs)"
183 libiec61883.cfg_params?= --enable-shared=no
184 libiec61883.mak_params?=; cd $(call bld_path,libiec61883,src); ln -sf . libiec61883
185 libjpeg.cfg_params?= --enable-shared=no
186 libogg.cfg_params?= --enable-shared=no
187 libraw1394.cfg_params?= --enable-shared=no; ln -sf src libraw1394
188 libtheora.cfg_vars?=PKG_CONFIG_PATH=$(call bld_path,libogg):$(call bld_path,libvorbis)
189 libtheora.cflags?="$(call inc_path,libogg,include) $(call inc_path,libogg,src) $(call inc_path,libvorbis,include)"
190 libtheora.ldflags?="$(call ld_path,libvorbis,lib/.libs) $(call ld_path,libogg,src/.libs)"
191 libtheora.cfg_params?= --disable-examples --disable-spec --enable-shared=no
192 libuuid.cfg_params?=--enable-shared=no
193 libvorbis.cfg_params?= --disable-oggtest --enable-shared=no
194 openjpeg.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
195 openjpeg.cfg_vars?=$(call cmake_config,.)
196 openjpeg.mak_params?= ; cd $(call bld_path,openjpeg,src/lib/openjp2); ln -sf . openjpeg-2.1
197 opencv.cfg_vars?=$(call cmake_config,.)
198 opencv.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
199 openexr.cfg_vars?=LD_LIBRARY_PATH=$(call bld_path,ilmbase,usr/lib)
200 openexr.cfg_params?=--enable-shared=no --with-ilmbase-prefix=$(call bld_path,ilmbase,usr)
201 speech_tools.mak_params?=-j1
202 twolame.cfg_params?=--enable-shared=no
203 x264.cfg_params?= --enable-static --enable-pic
204 x265.cfg_vars?=$(call cmake_config,source)
205 x265.cfg_params?= -DENABLE_SHARED=no
206 libvpx.cfg_params?= --enable-pic
209 pkg_cfg=$(call bld_path,$(1),usr/local/lib/pkgconfig):
210 LV2_PKGCFG:=$(subst : ,:,$(foreach p,lv2 serd sord sratom lilv suil,$(call pkg_cfg,$(p))))
214 $(1).cfg_vars+=./waf --version; find .waf* -type f -name "*.py" | \
215 while read f; do sed -e '/StopIter/d' -i "$(DS)f"; done; \
216 echo 'exec ./waf configure "$(DS)@"' > ./configure; chmod +x \
217 ./configure; PKG_CONFIG_PATH=$(LV2_PKGCFG) LD_LIBRARY_PATH=$(LV2_LIBPATH)
219 CFLAGS="-I$(call bld_path,lv2) $(foreach f,$(2), $(call inc_path,$(f))) -fPIC "\
220 LDFLAGS="-lm $(foreach f,$(2), $(call ld_path,$(f),usr/local/lib)) "
221 $(1).mak_vars=(echo "all:"; echo " ./waf -v build") > $(call bld_path,$(1),Makefile);
222 $(1).mak_params+=; ( cd $(1)*; ./waf install --destdir=$(call bld_path,$(1)) )
225 SYS_LIB:=$(notdir $(lastword $(wildcard /usr/lib /usrlib32 /usr/lib64)))
226 SYS_LV2:=$(lastword $(wildcard /usr/$(SYS_LIB)/lv2 /usr/local/$(SYS_LIB)/lv2))
227 $(if $(SYS_LV2),,$(eval SYS_LV2:=/usr/$(SYS_LIB)/lv2))
228 lv2.cfg_params?= --lv2dir=$(SYS_LV2)
229 SYS_LV2_PATH:=/usr/$(SYS_LIB)/lv2: /usr/local/$(SYS_LIB)/lv2:
230 DFT_LV2_PATH:= /usr/lib64/lv2: /usr/lib/lv2: /usr/local/lib64/lv2: /usr/local/lib/lv2:
231 LV2_PATH:=$(subst : ,:,$(SYS_LV2_PATH)$(filter-out $(SYS_LV2_PATH),$(DFT_LV2_PATH)))
232 lilv.cfg_params?= --static --default-lv2-path=$(LV2_PATH)
233 sratom.cfg_params?= --static --no-shared
234 serd.cfg_params?= --static --no-shared
235 sord.cfg_params?= --static --no-shared
236 lilv.cfg_params?= --static --dyn-manifest
237 suil.cfg_params?= --static --no-qt
239 $(eval $(call waf-setup,lv2))
240 $(eval $(call waf-setup,serd))
241 $(eval $(call waf-setup,sord, serd))
242 $(eval $(call waf-setup,sratom, serd sord lv2))
243 $(eval $(call waf-setup,lilv, lv2 sratom serd sord))
244 $(eval $(call waf-setup,suil, lv2))
246 # add softlinks for legacy paths
247 waf_link=$(1).mak_params+=; (cd $(1)*; ln -s $(1)-0/$(1) usr/local/include/.)
248 $(foreach p,sratom serd sord lilv suil,$(eval $(call waf_link,$(p))))
251 $(foreach tgt,$(TARGETS), \
252 $(if $($(tgt).cflags),$(eval $(tgt).cfg_vars+=CFLAGS+=$($(tgt).cflags))))
253 $(foreach tgt,$(TARGETS), \
254 $(if $($(tgt).cppflags),$(eval $(tgt).cfg_vars+=CPPFLAGS+=$($(tgt).cppflags))))
255 $(foreach tgt,$(TARGETS), \
256 $(if $($(tgt).ldflags),$(eval $(tgt).cfg_vars+=LDFLAGS+=$($(tgt).ldflags))))
262 #$(eval $(call std-build,pkg,deps...))
264 ifeq ($(MAKECMDGOALS),rules)
270 $(call rules,$(call std-build,a52dec,djbfft))
271 $(call rules,$(call std-build,djbfft))
272 $(call rules,$(call std-build,audiofile))
273 $(call rules,$(call std-build,encore))
274 $(call rules,$(call std-build,esound,audiofile))
275 $(call rules,$(call std-build,ffmpeg, twolame lame openjpeg opus libtheora x264 x265 libvpx))
276 $(call rules,$(call std-build,fftw))
277 $(call rules,$(call std-build,flac,libogg))
278 $(call rules,$(call std-build,giflib))
279 $(call rules,$(call std-build,ilmbase))
280 $(call rules,$(call std-build,ladspa))
281 $(call rules,$(call std-build,lame))
282 $(call rules,$(call std-build,libavc1394,libraw1394))
283 $(call rules,$(call std-build,libdv))
284 $(call rules,$(call std-build,libiec61883,libraw1394))
285 $(call rules,$(call std-build,libjpeg))
286 $(call rules,$(call std-build,libogg))
287 $(call rules,$(call std-build,libraw1394))
288 $(call rules,$(call std-build,libsndfile))
289 $(call rules,$(call std-build,libtheora, libogg libvorbis))
290 $(call rules,$(call std-build,libuuid))
291 $(call rules,$(call std-build,libvorbis))
292 $(call rules,$(call std-build,mjpegtools, libjpeg))
293 $(call rules,$(call std-build,opencv))
294 $(call rules,$(call std-build,openexr, ilmbase))
295 $(call rules,$(call std-build,openjpeg))
296 $(call rules,$(call std-build,opus))
297 $(call rules,$(call std-build,speech_tools))
298 $(call rules,$(call std-build,tiff))
299 $(call rules,$(call std-build,twolame))
300 $(call rules,$(call std-build,x264))
301 $(call rules,$(call std-build,x265))
302 $(call rules,$(call std-build,libvpx))
303 $(call rules,$(call std-build,lv2))
304 $(call rules,$(call std-build,serd))
305 $(call rules,$(call std-build,sord, serd))
306 $(call rules,$(call std-build,sratom, serd sord lv2))
307 $(call rules,$(call std-build,lilv, lv2 sratom serd sord))
308 $(call rules,$(call std-build,suil, lv2))
310 # specialize festival, multiple tarballs
312 .PHONY: festival festival-configure festival-src
313 festival: $(call pkg-built,festival)
314 festival-configure: $(call pkg-config,festival)
315 festival-src: $(call pkg-source,festival)
317 rm -rf festival* $(BLD)/festival.*
319 $(call pkg-source,festival):
320 for f in src/festival* src/festlex_* src/festvox_*; do tar -xJf $$f; done
323 $(call pkg-config,festival): $(call pkg-source,festival) $(call pkg-built,speech_tools)
324 cd festival* && [ -f ./configure ] && \
328 $(call pkg-built,festival): $(call pkg-config,festival)
329 $(MAKE) -C festival* -j1
333 for f in $(static_pkgs); do rm -rf $$f*; done
337 cp -a $(ver_mjpegtools)/mpeg2enc/mpeg2enc $(BINDIR)/.
338 cp -a $(ver_mjpegtools)/mplex/mplex $(BINDIR)/.
340 # not WANT_CIN_3RDPARTY
347 @echo $($(subst val-,,$@))