Nav apraksta

Makefile 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. #
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=ffmpeg
  9. PKG_VERSION:=0.11.5
  10. PKG_RELEASE:=5
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:=http://ffmpeg.org/releases/
  13. PKG_MD5SUM:=ea25fc252c132141f12988ed5506bfe8
  14. PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
  15. PKG_LICENSE:=LGPL-2.1+ GPL-2+ LGPL-3
  16. PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
  17. FFMPEG_CUSTOM_ENCODERS:= \
  18. ac3 \
  19. jpegls \
  20. mpeg1video \
  21. mpeg2video \
  22. mpeg4 \
  23. pcm_s16be \
  24. pcm_s16le \
  25. png \
  26. vorbis \
  27. zlib \
  28. FFMPEG_CUSTOM_DECODERS:= \
  29. aac \
  30. ac3 \
  31. alac \
  32. amrnb \
  33. amrwb \
  34. ape \
  35. atrac3 \
  36. flac \
  37. gif \
  38. h264 \
  39. jpegls \
  40. mp2 \
  41. mp3 \
  42. mpeg1video \
  43. mpeg2video \
  44. mpeg4 \
  45. mpegvideo \
  46. mpc7 \
  47. mpc8 \
  48. pcm_s16be \
  49. pcm_s16le \
  50. png \
  51. vorbis \
  52. wavpack \
  53. wmav1 \
  54. wmav2 \
  55. zlib \
  56. FFMPEG_CUSTOM_MUXERS:= \
  57. ac3 \
  58. ffm \
  59. h264 \
  60. mp3 \
  61. mp4 \
  62. mpeg1video \
  63. mpeg2video \
  64. mpegts \
  65. ogg \
  66. rtp \
  67. FFMPEG_CUSTOM_DEMUXERS:= \
  68. aac \
  69. ac3 \
  70. amr \
  71. ape \
  72. avi \
  73. flac \
  74. ffm \
  75. h264 \
  76. matroska \
  77. mov \
  78. mp3 \
  79. mpegps \
  80. mpegts \
  81. mpegvideo \
  82. mpc \
  83. mpc8 \
  84. ogg \
  85. rm \
  86. rtsp \
  87. rtp \
  88. sdp \
  89. v4l2 \
  90. wav \
  91. wv \
  92. FFMPEG_CUSTOM_PARSERS:= \
  93. aac \
  94. flac \
  95. ac3 \
  96. h264 \
  97. mpegaudio \
  98. mpeg4video \
  99. mpegvideo \
  100. FFMPEG_CUSTOM_PROTOCOLS:= \
  101. file http pipe rtp tcp udp
  102. FFMPEG_MINI_ENCODERS:= \
  103. FFMPEG_MINI_DECODERS:= \
  104. aac \
  105. ac3 \
  106. atrac3 \
  107. flac \
  108. h263 \
  109. h264 \
  110. jpegls \
  111. mp3 \
  112. mpeg1video \
  113. mpeg2video \
  114. mpeg4 \
  115. mpegvideo \
  116. png \
  117. wmav1 \
  118. wmav2 \
  119. FFMPEG_MINI_MUXERS:= \
  120. ffm \
  121. FFMPEG_MINI_DEMUXERS := \
  122. aac \
  123. ac3 \
  124. asf \
  125. avi \
  126. ffm \
  127. flac \
  128. h264 \
  129. matroska \
  130. mov \
  131. mp3 \
  132. mpegts \
  133. mpegvideo \
  134. sdp \
  135. rtsp \
  136. FFMPEG_MINI_PARSERS:= \
  137. ac3 \
  138. flac \
  139. h263 \
  140. h264 \
  141. mpeg4video \
  142. mpegaudio \
  143. FFMPEG_MINI_PROTOCOLS := \
  144. file http rtp tcp udp \
  145. FFMPEG_AUDIO_DECODERS:= \
  146. aac \
  147. aac_latm \
  148. ac3 \
  149. adpcm_* \
  150. alac \
  151. amrnb \
  152. amrwb \
  153. ape \
  154. atrac3 \
  155. flac \
  156. mp2 \
  157. mp3* \
  158. mpc7 \
  159. mpc8 \
  160. pcm_* \
  161. vorbis \
  162. wavpack \
  163. wmav1 \
  164. wmav2 \
  165. wmalossless \
  166. wmapro \
  167. zlib \
  168. FFMPEG_AUDIO_DEMUXERS:= \
  169. aac \
  170. ac3 \
  171. aiff \
  172. amr \
  173. ape \
  174. avi \
  175. flac \
  176. ffm \
  177. matroska \
  178. mp3 \
  179. mov \
  180. mpc \
  181. mpc8 \
  182. mpegts \
  183. ogg \
  184. rm \
  185. rtsp \
  186. rtp \
  187. sdp \
  188. wav \
  189. wv \
  190. FFMPEG_AUDIO_PARSERS:= \
  191. aac \
  192. aac_latm \
  193. flac \
  194. ac3 \
  195. mpegaudio \
  196. FFMPEG_AUDIO_PROTOCOLS:= \
  197. file http rtp tcp udp
  198. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  199. PKG_CONFIG_DEPENDS:= \
  200. $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
  201. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
  202. $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
  203. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
  204. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
  205. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
  206. include $(INCLUDE_DIR)/package.mk
  207. define Package/ffmpeg/Default
  208. TITLE:=FFmpeg
  209. URL:=http://ffmpeg.mplayerhq.hu/
  210. endef
  211. define Package/ffmpeg/Default/description
  212. FFmpeg is a a software package that can record, convert and stream digital
  213. audio and video in numerous formats.
  214. endef
  215. define Package/ffmpeg
  216. $(call Package/ffmpeg/Default)
  217. SECTION:=multimedia
  218. CATEGORY:=Multimedia
  219. TITLE+= program
  220. DEPENDS+= +libpthread +libffmpeg-full
  221. VARIANT:=full
  222. endef
  223. define Package/ffmpeg/description
  224. $(call Package/ffmpeg/Default/description)
  225. .
  226. This package contains the FFmpeg command line tool.
  227. endef
  228. define Package/ffprobe
  229. $(call Package/ffmpeg/Default)
  230. SECTION:=multimedia
  231. CATEGORY:=Multimedia
  232. TITLE+= CLI media identifier
  233. DEPENDS+= +libffmpeg-full
  234. VARIANT:=full
  235. endef
  236. define Package/ffprobe/description
  237. $(call Package/ffmpeg/Default/description)
  238. .
  239. This package contains the FFprobe command line tool.
  240. endef
  241. define Package/ffserver
  242. $(call Package/ffserver/Default)
  243. SECTION:=multimedia
  244. CATEGORY:=Multimedia
  245. TITLE+= streaming server
  246. DEPENDS+= +libpthread +libffmpeg-full
  247. VARIANT:=full
  248. endef
  249. define Package/ffserver/description
  250. $(call Package/ffmpeg/Default/description)
  251. .
  252. This package contains the FFmpeg streaming server.
  253. endef
  254. define Package/libffmpeg/Default
  255. $(call Package/ffmpeg/Default)
  256. SECTION:=libs
  257. CATEGORY:=Libraries
  258. TITLE+= libraries
  259. DEPENDS+= +libpthread +zlib +libbz2
  260. PROVIDES:= libffmpeg
  261. endef
  262. define Package/libffmpeg-custom
  263. $(call Package/libffmpeg/Default)
  264. TITLE+= (custom)
  265. DEPENDS+= @DEVEL +libspeex
  266. VARIANT:=custom
  267. MENU:=1
  268. endef
  269. define Package/libffmpeg-custom/config
  270. source "$(SOURCE)/Config.in"
  271. endef
  272. define Package/libffmpeg-custom/description
  273. $(call Package/ffmpeg/Default/description)
  274. .
  275. This package contains customized FFmpeg shared libraries.
  276. endef
  277. define Package/libffmpeg-audio-dec
  278. $(call Package/libffmpeg/Default)
  279. TITLE+= (audio)
  280. DEPENDS+= @DEVEL +libspeex
  281. VARIANT:=audio-dec
  282. endef
  283. define Package/libffmpeg-audio-dec/description
  284. $(call Package/ffmpeg/Default/description)
  285. .
  286. This package contains FFmpeg shared libraries for audio decoding
  287. endef
  288. define Package/libffmpeg-full
  289. $(call Package/libffmpeg/Default)
  290. TITLE+= (full)
  291. DEPENDS+= @BUILD_PATENTED +alsa-lib
  292. VARIANT:=full
  293. endef
  294. define Package/libffmpeg-full/description
  295. $(call Package/ffmpeg/Default/description)
  296. .
  297. This package contains full-featured FFmpeg shared libraries.
  298. endef
  299. define Package/libffmpeg-mini
  300. $(call Package/libffmpeg/Default)
  301. TITLE+= (mini)
  302. DEPENDS+= @BUILD_PATENTED
  303. VARIANT:=mini
  304. endef
  305. define Package/libffmpeg-mini/description
  306. $(call Package/ffmpeg/Default/description)
  307. .
  308. This package contains minimal-featured FFmpeg shared libraries.
  309. endef
  310. FFMPEG_CONFIGURE:= \
  311. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
  312. LDFLAGS="$(TARGET_LDFLAGS)" \
  313. ./configure \
  314. --enable-cross-compile \
  315. --cross-prefix="$(TARGET_CROSS)" \
  316. --arch="$(ARCH)" \
  317. --target-os=linux \
  318. --prefix="/usr" \
  319. --enable-shared \
  320. --enable-static \
  321. --disable-debug \
  322. --pkg-config="pkg-config" \
  323. \
  324. --enable-gpl \
  325. --enable-version3 \
  326. \
  327. --disable-altivec \
  328. --disable-asm \
  329. --disable-doc \
  330. --disable-dxva2 \
  331. --enable-pthreads \
  332. --disable-optimizations \
  333. --enable-small \
  334. --disable-stripping \
  335. --enable-zlib \
  336. --disable-outdevs
  337. ifeq ($(BUILD_VARIANT),custom)
  338. FFMPEG_ENABLE= \
  339. $(foreach c, $(2), \
  340. $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
  341. )
  342. FFMPEG_CONFIGURE+= \
  343. --disable-ffmpeg \
  344. --disable-ffplay \
  345. --disable-ffprobe \
  346. --disable-ffserver \
  347. --disable-avfilter \
  348. --disable-postproc \
  349. --disable-swresample \
  350. --disable-swscale \
  351. --disable-everything \
  352. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
  353. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
  354. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
  355. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
  356. $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
  357. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
  358. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
  359. FFMPEG_CONFIGURE+= \
  360. --enable-decoder=adpcm_ima_wav \
  361. --enable-decoder=adpcm_ima_qt \
  362. --enable-decoder=adpcm_ms \
  363. endif
  364. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
  365. FFMPEG_CONFIGURE+= \
  366. --enable-libspeex --enable-decoder=libspeex \
  367. endif
  368. endif
  369. ifeq ($(BUILD_VARIANT),audio-dec)
  370. FFMPEG_ENABLE= \
  371. $(foreach c, $(2), \
  372. --enable-$(1)="$(c)" \
  373. )
  374. FFMPEG_CONFIGURE+= \
  375. --disable-ffmpeg \
  376. --disable-ffplay \
  377. --disable-ffprobe \
  378. --disable-ffserver \
  379. --disable-avfilter \
  380. --disable-postproc \
  381. --disable-swresample \
  382. --disable-swscale \
  383. --disable-everything \
  384. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
  385. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
  386. $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
  387. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
  388. --enable-libspeex --enable-decoder=libspeex \
  389. --disable-decoder=pcm_bluray,pcm_dvd \
  390. endif
  391. ifeq ($(BUILD_VARIANT),mini)
  392. FFMPEG_ENABLE= \
  393. $(foreach c, $(2), \
  394. --enable-$(1)="$(c)" \
  395. )
  396. FFMPEG_CONFIGURE+= \
  397. --disable-ffmpeg \
  398. --disable-ffplay \
  399. --disable-ffprobe \
  400. --disable-ffserver \
  401. --disable-avdevice \
  402. --disable-avfilter \
  403. --disable-postproc \
  404. --disable-swresample \
  405. --disable-swscale \
  406. --disable-everything \
  407. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_MINI_ENCODERS)) \
  408. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
  409. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_MINI_MUXERS)) \
  410. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
  411. $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
  412. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
  413. endif
  414. ifneq ($(CONFIG_TARGET_x86),)
  415. TARGET_CFLAGS += -fomit-frame-pointer
  416. endif
  417. define Build/Configure
  418. ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
  419. endef
  420. define Build/Compile
  421. $(MAKE) -C $(PKG_BUILD_DIR) \
  422. DESTDIR="$(PKG_INSTALL_DIR)" \
  423. all install
  424. endef
  425. define Build/InstallDev/custom
  426. $(INSTALL_DIR) $(1)/usr/include
  427. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
  428. $(INSTALL_DIR) $(1)/usr/lib
  429. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
  430. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  431. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  432. endef
  433. define Build/InstallDev/full
  434. $(INSTALL_DIR) $(1)/usr/include
  435. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/
  436. $(INSTALL_DIR) $(1)/usr/lib
  437. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/
  438. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  439. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
  440. endef
  441. define Build/InstallDev/mini
  442. $(INSTALL_DIR) $(1)/usr/include
  443. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
  444. $(INSTALL_DIR) $(1)/usr/lib
  445. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
  446. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  447. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  448. endef
  449. Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
  450. # XXX: attempt at installing "best" dev files available
  451. ifeq ($(BUILD_VARIANT),custom)
  452. # XXX: only install "custom" dev files if -full & -mini are not selected
  453. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  454. Build/InstallDev = $(Build/InstallDev/custom)
  455. endif
  456. endif
  457. ifeq ($(BUILD_VARIANT),audio-dec)
  458. # XXX: only install "audio-dec" dev files if -full & -mini are not selected
  459. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  460. Build/InstallDev = $(Build/InstallDev/audio-dec)
  461. endif
  462. endif
  463. ifeq ($(BUILD_VARIANT),full)
  464. # XXX: always install "full" dev files if -full is selected
  465. Build/InstallDev = $(Build/InstallDev/full)
  466. endif
  467. ifeq ($(BUILD_VARIANT),mini)
  468. # XXX: only install "mini" dev files if -full is not selected
  469. ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
  470. Build/InstallDev = $(Build/InstallDev/mini)
  471. endif
  472. endif
  473. define Package/ffmpeg/install
  474. $(INSTALL_DIR) $(1)/usr/bin
  475. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
  476. endef
  477. define Package/ffprobe/install
  478. $(INSTALL_DIR) $(1)/usr/bin
  479. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
  480. endef
  481. define Package/ffserver/install
  482. $(INSTALL_DIR) $(1)/usr/bin
  483. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
  484. endef
  485. define Package/libffmpeg-custom/install
  486. $(INSTALL_DIR) $(1)/usr/lib
  487. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
  488. endef
  489. define Package/libffmpeg-full/install
  490. $(INSTALL_DIR) $(1)/usr/lib
  491. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/
  492. endef
  493. define Package/libffmpeg-mini/install
  494. $(INSTALL_DIR) $(1)/usr/lib
  495. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
  496. endef
  497. Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
  498. $(eval $(call BuildPackage,ffmpeg))
  499. $(eval $(call BuildPackage,ffprobe))
  500. $(eval $(call BuildPackage,ffserver))
  501. $(eval $(call BuildPackage,libffmpeg-custom))
  502. $(eval $(call BuildPackage,libffmpeg-full))
  503. $(eval $(call BuildPackage,libffmpeg-mini))
  504. $(eval $(call BuildPackage,libffmpeg-audio-dec))