You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

797 lines
19 KiB

  1. #
  2. # Copyright (C) 2017-2019 Ian Leonard <antonlacon@gmail.com>
  3. # Copyright (C) 2018 Ted Hess <thess@kitschensync.net>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=ffmpeg
  10. PKG_VERSION:=3.4.7
  11. PKG_RELEASE:=4
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  13. PKG_SOURCE_URL:=https://ffmpeg.org/releases/
  14. PKG_HASH:=efd01782fd29b62505c973f5b61a65632d7b435dc9f4a6c97e92e6afd36cf5c8
  15. PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
  16. Ian Leonard <antonlacon@gmail.com>
  17. PKG_LICENSE:=LGPL-2.1-or-later GPL-2.0-or-later LGPL-3.0-or-later
  18. PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
  19. PKG_CPE_ID:=cpe:/a:ffmpeg:ffmpeg
  20. FFMPEG_CUSTOM_ENCODERS:= \
  21. ac3 \
  22. jpegls \
  23. mpeg1video \
  24. mpeg2video \
  25. mpeg4 \
  26. pcm_s16be \
  27. pcm_s16le \
  28. png \
  29. vorbis \
  30. zlib \
  31. FFMPEG_CUSTOM_DECODERS:= \
  32. aac \
  33. ac3 \
  34. alac \
  35. amrnb \
  36. amrwb \
  37. ape \
  38. atrac3 \
  39. flac \
  40. gif \
  41. h264 \
  42. hevc \
  43. jpegls \
  44. mp2 \
  45. mp3 \
  46. mpeg1video \
  47. mpeg2video \
  48. mpeg4 \
  49. mpegvideo \
  50. mpc7 \
  51. mpc8 \
  52. pcm_s16be \
  53. pcm_s16le \
  54. png \
  55. vc1 \
  56. vorbis \
  57. wavpack \
  58. wmav1 \
  59. wmav2 \
  60. zlib \
  61. FFMPEG_CUSTOM_MUXERS:= \
  62. ac3 \
  63. ffm \
  64. h264 \
  65. hevc \
  66. mp3 \
  67. mp4 \
  68. mpeg1video \
  69. mpeg2video \
  70. mpegts \
  71. ogg \
  72. rtp \
  73. FFMPEG_CUSTOM_DEMUXERS:= \
  74. aac \
  75. ac3 \
  76. amr \
  77. ape \
  78. avi \
  79. flac \
  80. ffm \
  81. h264 \
  82. hevc \
  83. matroska \
  84. mov \
  85. mp3 \
  86. mpegps \
  87. mpegts \
  88. mpegvideo \
  89. mpc \
  90. mpc8 \
  91. ogg \
  92. rm \
  93. rtsp \
  94. rtp \
  95. sdp \
  96. v4l2 \
  97. vc1 \
  98. wav \
  99. wv \
  100. FFMPEG_CUSTOM_PARSERS:= \
  101. aac \
  102. flac \
  103. ac3 \
  104. h264 \
  105. hevc \
  106. mpegaudio \
  107. mpeg4video \
  108. mpegvideo \
  109. vc1 \
  110. FFMPEG_CUSTOM_PROTOCOLS:= \
  111. file http icecast pipe rtp tcp udp
  112. FFMPEG_MINI_DECODERS:= \
  113. ac3 \
  114. flac \
  115. jpegls \
  116. mp2 \
  117. mp3 \
  118. mpeg1video \
  119. mpeg2video \
  120. mpeg4 \
  121. mpegvideo \
  122. opus \
  123. png \
  124. vorbis \
  125. FFMPEG_PATENTED_MINI_DECODERS:= \
  126. h264 \
  127. hevc \
  128. vc1 \
  129. FFMPEG_MINI_DEMUXERS:= \
  130. avi \
  131. flac \
  132. matroska \
  133. mov \
  134. mp3 \
  135. mpegps \
  136. mpegts \
  137. mpegvideo \
  138. ogg \
  139. FFMPEG_MINI_PROTOCOLS:= \
  140. file
  141. FFMPEG_AUDIO_DECODERS:= \
  142. ac3 \
  143. adpcm_* \
  144. alac \
  145. amrnb \
  146. amrwb \
  147. ape \
  148. atrac3 \
  149. flac \
  150. mp2 \
  151. mp3* \
  152. mpc7 \
  153. mpc8 \
  154. opus \
  155. pcm_* \
  156. vorbis \
  157. wavpack \
  158. zlib \
  159. FFMPEG_AUDIO_DEMUXERS:= \
  160. ac3 \
  161. aiff \
  162. amr \
  163. ape \
  164. avi \
  165. flac \
  166. ffm \
  167. matroska \
  168. mp3 \
  169. mov \
  170. mpc \
  171. mpc8 \
  172. mpegts \
  173. ogg \
  174. rm \
  175. rtsp \
  176. rtp \
  177. sdp \
  178. wav \
  179. wv \
  180. FFMPEG_AUDIO_PROTOCOLS:= \
  181. file http icecast rtp tcp udp
  182. FFMPEG_PATENTED_DECODERS:= \
  183. atrac3 \
  184. h264 \
  185. hevc \
  186. vc1 \
  187. FFMPEG_PATENTED_ENCODERS:=$(FFMPEG_PATENDED_DECODERS)
  188. FFMPEG_PATENTED_MUXERS:= \
  189. h264 \
  190. hevc \
  191. vc1 \
  192. FFMPEG_PATENTED_DEMUXERS:=$(FFMPEG_PATENTED_MUXERS)
  193. FFMPEG_PATENTED_PARSERS:= \
  194. h264 \
  195. hevc \
  196. vc1 \
  197. PKG_CONFIG_DEPENDS:= \
  198. $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
  199. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
  200. $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_MUXERS)) \
  201. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
  202. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
  203. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
  204. include $(INCLUDE_DIR)/package.mk
  205. define Package/ffmpeg/Default
  206. TITLE:=FFmpeg
  207. URL:=https://ffmpeg.org/
  208. DEPENDS+= +libpthread
  209. endef
  210. define Package/ffmpeg/Default/description
  211. FFmpeg is a a software package that can record, convert and stream digital
  212. audio and video in numerous formats.
  213. FFmpeg licensing / patent issues are complex. It is the reponsibility of the
  214. user to understand any requirements in this regard with its usage. See:
  215. https://ffmpeg.org/legal.html for further information.
  216. endef
  217. define Package/ffmpeg
  218. $(call Package/ffmpeg/Default)
  219. SECTION:=multimedia
  220. CATEGORY:=Multimedia
  221. TITLE+= program
  222. DEPENDS+= +libffmpeg-full
  223. VARIANT:=full
  224. endef
  225. define Package/ffmpeg-custom
  226. $(call Package/ffmpeg/Default)
  227. SECTION:=multimedia
  228. CATEGORY:=Multimedia
  229. TITLE+= program (custom)
  230. DEPENDS+= @!ALL libffmpeg-custom
  231. VARIANT:=custom
  232. endef
  233. define Package/ffmpeg/description
  234. $(call Package/ffmpeg/Default/description)
  235. .
  236. This package contains the FFmpeg command line tool.
  237. endef
  238. Package/ffmpeg-custom/description = $(Package/ffmpeg/description)
  239. define Package/ffprobe
  240. $(call Package/ffmpeg/Default)
  241. SECTION:=multimedia
  242. CATEGORY:=Multimedia
  243. TITLE+= CLI media identifier
  244. DEPENDS+= +libffmpeg-full
  245. VARIANT:=full
  246. endef
  247. define Package/ffprobe-custom
  248. $(call Package/ffmpeg/Default)
  249. SECTION:=multimedia
  250. CATEGORY:=Multimedia
  251. TITLE+= CLI media identifier (custom)
  252. DEPENDS+= @!ALL libffmpeg-custom
  253. VARIANT:=custom
  254. endef
  255. define Package/ffprobe/description
  256. $(call Package/ffmpeg/Default/description)
  257. .
  258. This package contains the FFprobe command line tool.
  259. endef
  260. Package/ffprobe-custom/description = $(Package/ffprobe/description)
  261. define Package/ffserver
  262. $(call Package/ffmpeg/Default)
  263. SECTION:=multimedia
  264. CATEGORY:=Multimedia
  265. TITLE+= streaming server
  266. DEPENDS+= +libffmpeg-full
  267. VARIANT:=full
  268. endef
  269. define Package/ffserver-custom
  270. $(call Package/ffmpeg/Default)
  271. SECTION:=multimedia
  272. CATEGORY:=Multimedia
  273. TITLE+= streaming server (custom)
  274. DEPENDS+= @!ALL libffmpeg-custom
  275. VARIANT:=custom
  276. endef
  277. define Package/ffserver/description
  278. $(call Package/ffmpeg/Default/description)
  279. .
  280. This package contains the FFmpeg streaming server.
  281. endef
  282. Package/ffserver-custom/description = $(Package/ffserver/description)
  283. define Package/libffmpeg/Default
  284. $(call Package/ffmpeg/Default)
  285. SECTION:=libs
  286. CATEGORY:=Libraries
  287. TITLE+= libraries
  288. DEPENDS+= +libpthread +zlib +libbz2
  289. PROVIDES:= libffmpeg
  290. endef
  291. # Package build suppressed when CONFIG_ALL=y
  292. define Package/libffmpeg-custom
  293. $(call Package/libffmpeg/Default)
  294. TITLE+= (custom)
  295. DEPENDS+= @!ALL \
  296. +FFMPEG_CUSTOM_SELECT_libopus:libopus \
  297. +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib \
  298. +FFMPEG_CUSTOM_SELECT_libshine:shine \
  299. +PACKAGE_fdk-aac:fdk-aac
  300. VARIANT:=custom
  301. MENU:=1
  302. endef
  303. define Package/libffmpeg-custom/config
  304. source "$(SOURCE)/Config.in"
  305. endef
  306. define Package/libffmpeg-custom/description
  307. $(call Package/ffmpeg/Default/description)
  308. .
  309. This package contains customized FFmpeg shared libraries.
  310. endef
  311. define Package/libffmpeg-audio-dec
  312. $(call Package/libffmpeg/Default)
  313. TITLE+= (audio)
  314. VARIANT:=audio-dec
  315. endef
  316. define Package/libffmpeg-audio-dec/description
  317. $(call Package/ffmpeg/Default/description)
  318. .
  319. This package contains FFmpeg shared libraries for audio decoding
  320. endef
  321. define Package/libffmpeg-full
  322. $(call Package/libffmpeg/Default)
  323. TITLE+= (full)
  324. DEPENDS+= +alsa-lib +PACKAGE_libopus:libopus \
  325. +SOFT_FLOAT:shine \
  326. +!SOFT_FLOAT:lame-lib \
  327. +PACKAGE_libx264:libx264 \
  328. +!PACKAGE_libx264:fdk-aac
  329. VARIANT:=full
  330. endef
  331. define Package/libffmpeg-full/description
  332. $(call Package/ffmpeg/Default/description)
  333. .
  334. This package contains full-featured FFmpeg shared libraries.
  335. endef
  336. define Package/libffmpeg-mini
  337. $(call Package/libffmpeg/Default)
  338. TITLE+= (mini)
  339. VARIANT:=mini
  340. endef
  341. define Package/libffmpeg-mini/description
  342. $(call Package/ffmpeg/Default/description)
  343. .
  344. This package contains minimal-featured FFmpeg shared libraries.
  345. endef
  346. # Strip off FPU notation
  347. REAL_CPU_TYPE:=$(firstword $(subst +, ,$(CONFIG_CPU_TYPE)))
  348. # Fixup cpu types recogized by ffmpeg configure
  349. REAL_CPU_TYPE:=$(subst octeonplus,octeon+,$(REAL_CPU_TYPE))
  350. FFMPEG_CONFIGURE:= \
  351. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
  352. LDFLAGS="$(TARGET_LDFLAGS)" \
  353. ./configure \
  354. --enable-cross-compile \
  355. --cross-prefix="$(TARGET_CROSS)" \
  356. --arch="$(ARCH)" \
  357. $(if $(REAL_CPU_TYPE),--cpu=$(call qstrip,$(REAL_CPU_TYPE)),) \
  358. --target-os=linux \
  359. --prefix="/usr" \
  360. --pkg-config="pkg-config" \
  361. --enable-shared \
  362. --enable-static \
  363. --enable-pthreads \
  364. --enable-zlib \
  365. --disable-doc \
  366. --disable-debug \
  367. \
  368. --disable-lzma \
  369. --disable-vaapi \
  370. --disable-vdpau \
  371. --disable-outdevs
  372. ifeq ($(CONFIG_SOFT_FLOAT),y)
  373. FFMPEG_CONFIGURE+= \
  374. --disable-altivec \
  375. --disable-vsx \
  376. --disable-power8 \
  377. --disable-armv5te \
  378. --disable-armv6 \
  379. --disable-armv6t2 \
  380. --disable-inline-asm \
  381. --disable-mipsdsp \
  382. --disable-mipsdspr2 \
  383. --disable-mipsfpu \
  384. --disable-msa \
  385. --disable-mmi \
  386. --disable-fast-unaligned \
  387. --disable-runtime-cpudetect
  388. else ifneq ($(findstring arm,$(CONFIG_ARCH)),)
  389. FFMPEG_CONFIGURE+= \
  390. --disable-runtime-cpudetect
  391. # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700)
  392. else ifneq ($(findstring powerpc,$(CONFIG_ARCH)),)
  393. FFMPEG_CONFIGURE+= \
  394. --disable-altivec
  395. endif
  396. # libavcodec/mips/aacdec_mips.c build problem
  397. # XXX: disable use of assembly on MIPS. Patches welcome.
  398. ifneq ($(findstring mips,$(CONFIG_ARCH)),)
  399. FFMPEG_CONFIGURE+= \
  400. --disable-asm --disable-inline-asm
  401. endif
  402. # selectively disable optimizations according to arch/cpu type
  403. ifneq ($(findstring arm,$(CONFIG_ARCH)),)
  404. FFMPEG_CONFIGURE+= --enable-lto
  405. ifneq ($(findstring vfp,$(CONFIG_TARGET_OPTIMIZATION)),)
  406. FFMPEG_CONFIGURE+= --enable-vfp
  407. else
  408. FFMPEG_CONFIGURE+= --disable-vfp
  409. endif
  410. ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),)
  411. FFMPEG_CONFIGURE+= \
  412. --enable-neon \
  413. --enable-vfp
  414. else
  415. FFMPEG_CONFIGURE+= --disable-neon
  416. endif
  417. endif
  418. ifeq ($(ARCH),x86_64)
  419. FFMPEG_CONFIGURE+= --enable-lto
  420. endif
  421. ifeq ($(CONFIG_FFMPEG_X86ASM),y)
  422. FFMPEG_CONFIGURE += --enable-x86asm
  423. else
  424. FFMPEG_CONFIGURE += --disable-x86asm
  425. endif
  426. ifeq ($(BUILD_VARIANT),full)
  427. FFMPEG_DISABLE= \
  428. $(foreach c, $(2), \
  429. --disable-$(1)="$(c)" \
  430. )
  431. FFMPEG_CONFIGURE+= \
  432. --enable-avresample \
  433. $(if $(CONFIG_BUILD_PATENTED),, \
  434. $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \
  435. $(call FFMPEG_DISABLE,encoder,$(FFMPEG_PATENTED_ENCODERS)) \
  436. $(call FFMPEG_DISABLE,muxer,$(FFMPEG_PATENTED_MUXERS)) \
  437. $(call FFMPEG_DISABLE,demuxer,$(FFMPEG_PATENTED_DEMUXERS)) \
  438. $(call FFMPEG_DISABLE,parser,$(FFMPEG_PATENTED_PARSERS))) \
  439. $(if $(CONFIG_PACKAGE_libopus),--enable-libopus)
  440. ifeq ($(CONFIG_SOFT_FLOAT),y)
  441. FFMPEG_CONFIGURE+= \
  442. --enable-small \
  443. \
  444. $(if $(CONFIG_PACKAGE_shine),--enable-libshine)
  445. else
  446. ifeq ($(ARCH),x86_64)
  447. FFMPEG_CONFIGURE+= --enable-hardcoded-tables
  448. else
  449. FFMPEG_CONFIGURE+= --enable-small
  450. endif
  451. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame)
  452. endif
  453. # x264 support and fdk-aac support can't coexist and be distributed.
  454. # Prioritize x264 over fdk-aac in default builds (maintain status-quo).
  455. ifneq ($(CONFIG_PACKAGE_libx264),)
  456. FFMPEG_CONFIGURE+= \
  457. --enable-gpl \
  458. --enable-libx264
  459. else
  460. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_fdk-aac),--enable-libfdk-aac)
  461. endif
  462. endif
  463. ifeq ($(BUILD_VARIANT),custom)
  464. FFMPEG_ENABLE= \
  465. $(foreach c, $(2), \
  466. $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
  467. )
  468. ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE),y)
  469. FFMPEG_CONFIGURE+= \
  470. --enable-hardcoded-tables
  471. else
  472. FFMPEG_CONFIGURE+= \
  473. --enable-small
  474. endif
  475. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL),y)
  476. FFMPEG_CONFIGURE+= --enable-gpl
  477. endif
  478. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3),y)
  479. FFMPEG_CONFIGURE+= --enable-version3
  480. endif
  481. ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE),y)
  482. FFMPEG_CONFIGURE+= --enable-nonfree
  483. endif
  484. ifneq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  485. FFMPEG_CONFIGURE+= \
  486. --disable-programs \
  487. --disable-avfilter \
  488. --disable-swresample
  489. endif
  490. FFMPEG_CONFIGURE+= \
  491. --disable-swscale \
  492. --disable-everything \
  493. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
  494. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
  495. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
  496. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
  497. $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
  498. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
  499. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
  500. FFMPEG_CONFIGURE+= \
  501. --enable-decoder=adpcm_ima_wav \
  502. --enable-decoder=adpcm_ima_qt \
  503. --enable-decoder=adpcm_ms
  504. endif
  505. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac),y)
  506. FFMPEG_CONFIGURE+= \
  507. --enable-libfdk-aac --enable-encoder=libfdk_aac
  508. endif
  509. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame),y)
  510. FFMPEG_CONFIGURE+= \
  511. --enable-libmp3lame --enable-encoder=libmp3lame
  512. endif
  513. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
  514. FFMPEG_CONFIGURE+= \
  515. --enable-libopus --enable-decoder=libopus --enable-encoder=libopus
  516. endif
  517. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine),y)
  518. FFMPEG_CONFIGURE+= \
  519. --enable-libshine --enable-encoder=libshine
  520. endif
  521. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  522. FFMPEG_CONFIGURE+= \
  523. --enable-libx264 --enable-encoder=libx264
  524. else
  525. FFMPEG_CONFIGURE+= --disable-postproc
  526. endif
  527. endif
  528. ifeq ($(BUILD_VARIANT),audio-dec)
  529. FFMPEG_ENABLE= \
  530. $(foreach c, $(2), \
  531. --enable-$(1)="$(c)" \
  532. )
  533. FFMPEG_CONFIGURE+= \
  534. --enable-small \
  535. --enable-gpl \
  536. \
  537. --disable-programs \
  538. --disable-avfilter \
  539. --disable-postproc \
  540. --disable-swresample \
  541. --disable-swscale \
  542. --disable-everything \
  543. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
  544. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
  545. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
  546. --disable-decoder=pcm_bluray,pcm_dvd
  547. endif
  548. ifeq ($(BUILD_VARIANT),mini)
  549. FFMPEG_ENABLE= \
  550. $(foreach c, $(2), \
  551. --enable-$(1)="$(c)" \
  552. )
  553. FFMPEG_CONFIGURE+= \
  554. --enable-small \
  555. \
  556. --disable-programs \
  557. --disable-avdevice \
  558. --disable-avfilter \
  559. --disable-postproc \
  560. --disable-swresample \
  561. --disable-swscale \
  562. --disable-everything \
  563. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
  564. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
  565. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
  566. $(if $(CONFIG_BUILD_PATENTED), \
  567. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_PATENTED_MINI_DECODERS)))
  568. endif
  569. ifneq ($(CONFIG_TARGET_x86),)
  570. TARGET_CFLAGS+= -fomit-frame-pointer
  571. endif
  572. define Build/Configure
  573. ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
  574. endef
  575. define Build/Compile
  576. $(MAKE) -C $(PKG_BUILD_DIR) \
  577. DESTDIR="$(PKG_INSTALL_DIR)" \
  578. all install
  579. endef
  580. define Build/InstallDev/custom
  581. $(INSTALL_DIR) $(1)/usr/include
  582. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
  583. $(INSTALL_DIR) $(1)/usr/lib
  584. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
  585. ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  586. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.{a,so*} $(1)/usr/lib/
  587. endif
  588. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  589. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  590. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  591. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
  592. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
  593. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
  594. endif
  595. endef
  596. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  597. define Build/InstallDev/full
  598. $(INSTALL_DIR) $(1)/usr/include
  599. $(INSTALL_DIR) $(1)/usr/lib
  600. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  601. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale} $(1)/usr/include/
  602. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.{a,so*} $(1)/usr/lib/
  603. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
  604. ifneq ($(CONFIG_PACKAGE_libx264),)
  605. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
  606. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
  607. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
  608. endif
  609. endef
  610. define Build/InstallDev/mini
  611. $(INSTALL_DIR) $(1)/usr/include
  612. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
  613. $(INSTALL_DIR) $(1)/usr/lib
  614. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
  615. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  616. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  617. endef
  618. Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
  619. # XXX: attempt at installing "best" dev files available
  620. ifeq ($(BUILD_VARIANT),custom)
  621. # XXX: only install "custom" dev files if -full & -mini are not selected
  622. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  623. Build/InstallDev = $(Build/InstallDev/custom)
  624. endif
  625. endif
  626. ifeq ($(BUILD_VARIANT),audio-dec)
  627. # XXX: only install "audio-dec" dev files if -full & -mini are not selected
  628. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  629. Build/InstallDev = $(Build/InstallDev/audio-dec)
  630. endif
  631. endif
  632. ifeq ($(BUILD_VARIANT),full)
  633. # XXX: always install "full" dev files if -full is selected
  634. Build/InstallDev = $(Build/InstallDev/full)
  635. endif
  636. ifeq ($(BUILD_VARIANT),mini)
  637. # XXX: only install "mini" dev files if -full is not selected
  638. ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
  639. Build/InstallDev = $(Build/InstallDev/mini)
  640. endif
  641. endif
  642. define Package/ffmpeg/install
  643. $(INSTALL_DIR) $(1)/usr/bin
  644. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
  645. endef
  646. Package/ffmpeg-custom/install = $(Package/ffmpeg/install)
  647. define Package/ffprobe/install
  648. $(INSTALL_DIR) $(1)/usr/bin
  649. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
  650. endef
  651. Package/ffprobe-custom/install = $(Package/ffprobe/install)
  652. define Package/ffserver/install
  653. $(INSTALL_DIR) $(1)/usr/bin
  654. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
  655. endef
  656. Package/ffserver-custom/install = $(Package/ffserver/install)
  657. define Package/libffmpeg-custom/install
  658. $(INSTALL_DIR) $(1)/usr/lib
  659. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
  660. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  661. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
  662. endif
  663. ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  664. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.so.* $(1)/usr/lib/
  665. endif
  666. endef
  667. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  668. define Package/libffmpeg-full/install
  669. $(INSTALL_DIR) $(1)/usr/lib
  670. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.so.* $(1)/usr/lib/
  671. ifneq ($(CONFIG_PACKAGE_libx264),)
  672. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
  673. endif
  674. endef
  675. define Package/libffmpeg-mini/install
  676. $(INSTALL_DIR) $(1)/usr/lib
  677. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
  678. endef
  679. Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
  680. $(eval $(call BuildPackage,ffmpeg))
  681. $(eval $(call BuildPackage,ffprobe))
  682. $(eval $(call BuildPackage,ffserver))
  683. $(eval $(call BuildPackage,ffmpeg-custom))
  684. $(eval $(call BuildPackage,ffprobe-custom))
  685. $(eval $(call BuildPackage,ffserver-custom))
  686. $(eval $(call BuildPackage,libffmpeg-audio-dec))
  687. $(eval $(call BuildPackage,libffmpeg-full))
  688. $(eval $(call BuildPackage,libffmpeg-mini))
  689. $(eval $(call BuildPackage,libffmpeg-custom))