libamcodec: New Package
PATCH v2 1/1 libamcodec: New Package
changes:
v1 -> v2:
- use git repo as should.
- add hash file.
- add alsa-lib dependecy.
- fix linkage errors.
- use the correct env vars in makefile calls.
--- package/Config.in | 1 + .../0001-fix_non_cross_compile_env_vars.patch | 23 +++++++++++++++ package/libamcodec/Config.in | 12 ++++++++ package/libamcodec/libamcodec.hash | 2 ++ package/libamcodec/libamcodec.mk | 33 ++++++++++++++++++++++ 5 files changed, 71 insertions(+) create mode 100644 package/libamcodec/0001-fix_non_cross_compile_env_vars.patch create mode 100644 package/libamcodec/Config.in create mode 100644 package/libamcodec/libamcodec.hash create mode 100644 package/libamcodec/libamcodec.mk
package/Config.in +1 -0
@@ -1074,6 +1074,7 @@ endmenu menu "Multimedia" source "package/bitstream/Config.in" + source "package/libamcodec/Config.in" source "package/libass/Config.in" source "package/libbluray/Config.in" source "package/libdcadec/Config.in"
package/libamcodec/0001-fix_non_cross_compile_env_vars.patch new file +23 -0
@@ -0,0 +1,23 @@ +--- a/amcodec/Makefile 2016-06-01 22:40:01.000000000 +0300 ++++ b/amcodec/Makefile 2016-06-01 22:41:32.000000000 +0300 +@@ -7,13 +7,13 @@ QUITE_CMD=1 + + INSTALL_FLAGS=-m 755 + +-CPP=g++ +-AS=as +-AR=ar +-LD=ld +-NM=nm +-STRIP=strip +-OBJCOPY=objcopy ++CPP ?= g++ ++AS ?= as ++AR ?= ar ++LD ?= ld ++NM ?= nm ++STRIP ?= strip ++OBJCOPY ?= objcopy + export CC CPP AS AR LD NM STRIP OBJCOPY + + TOPDIR=$(shell pwd)
package/libamcodec/Config.in new file +12 -0
@@ -0,0 +1,12 @@ +comment "libamcodec needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS + +config BR2_PACKAGE_LIBAMCODEC + bool "libamcodec" + depends on BR2_arm || BR2_aarch64 + depends on BR2_TOOLCHAIN_HAS_THREADS # alsa-lib + select BR2_PACKAGE_ALSA_LIB + help + Interface library for Amlogic media codecs + + https://github.com/mdrjr/c2_aml_libs.git
package/libamcodec/libamcodec.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally computed +sha256 44580255c63bde1544b1376bc8d33f73ef0c634afda5065455a01b77f6e2729b libamcodec-ed1d8b8c54b05c1a02a8ee44c59744e4cbed3d8d.tar.gz
package/libamcodec/libamcodec.mk new file +33 -0
@@ -0,0 +1,33 @@ +################################################################################ +# +# libamcodec +# +################################################################################ + +LIBAMCODEC_VERSION = ed1d8b8c54b05c1a02a8ee44c59744e4cbed3d8d +LIBAMCODEC_SITE = $(call github,mdrjr,c2_aml_libs,$(LIBAMCODEC_VERSION)) +LIBAMCODEC_DEPENDENCIES = alsa-lib + +# this pkg uses a non standard prefix vars, so we need to use them. +define LIBAMCODEC_BUILD_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/amavutils M_PREFIX="$(STAGING_DIR)/usr" + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/amadec M_PREFIX="$(STAGING_DIR)/usr" + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/amcodec PREFIX="$(STAGING_DIR)" +endef + +define LIBAMCODEC_INSTALL_STAGING_CMDS + $(INSTALL) -D -m 0755 $(@D)/amavutils/libamavutils.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amadec/libamadec.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(STAGING_DIR)/usr/lib + + mkdir -p $(STAGING_DIR)/usr/include/amcodec + cp -rf $(@D)/amcodec/include/* $(STAGING_DIR)/usr/include/amcodec +endef + +define LIBAMCODEC_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/amavutils/libamavutils.so $(TARGET_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amadec/libamadec.so $(TARGET_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(TARGET_DIR)/usr/lib +endef + +$(eval $(generic-package))
Signature · 1 line
2.8.3
PATCH v2 1/1 libamcodec: New Package
Hello,
Thanks for this new iteration!
Quoted 7 lines · Dagg
+-CPP=g++ +-AS=as +-AR=ar +-LD=ld +-NM=nm +-STRIP=strip +-OBJCOPY=objcopy
Quoted 7 lines
++CPP ?= g++
++AS ?= as
++AR ?= ar
++LD ?= ld
++NM ?= nm
++STRIP ?= strip
++OBJCOPY ?= objcopy
This patch would not be needed if $(TARGET_CONFIGURE_OPTS) was passed as a make option instead of in the make environment. I.e
$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS)
instead of
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE)
However, this also means that a number of other variables from your package Makefile will be overridden, such as CFLAGS, CXXFLAGS, LDFLAGS, etc. This sometimes causes some problems.
package/libamcodec/Config.in line 2
Quoted 2 lines
package/libamcodec/Config.in new file +2
-0+comment "libamcodec needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS
You need to replicate the architecture dependency here, so that the comment is not needlessly displayed on architectures for which the libamcodec option will anyway not be available, regardless of the availability of thread support.
package/libamcodec/libamcodec.mk line 11
Quoted 5 lines
package/libamcodec/libamcodec.mk new file +5
-0+LIBAMCODEC_VERSION = ed1d8b8c54b05c1a02a8ee44c59744e4cbed3d8d +LIBAMCODEC_SITE = $(call github,mdrjr,c2_aml_libs,$(LIBAMCODEC_VERSION)) +LIBAMCODEC_DEPENDENCIES = alsa-lib + +# this pkg uses a non standard prefix vars, so we need to use them.
# This package uses the M_PREFIX variable to construct the header and
# library paths used when compiling.
is probably a slightly better explanation.
package/libamcodec/libamcodec.mk line 21
Quoted 10 lines
package/libamcodec/libamcodec.mk new file +10
-0+define LIBAMCODEC_BUILD_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/amavutils M_PREFIX="$(STAGING_DIR)/usr" + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/amadec M_PREFIX="$(STAGING_DIR)/usr" + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/amcodec PREFIX="$(STAGING_DIR)" +endef + +define LIBAMCODEC_INSTALL_STAGING_CMDS + $(INSTALL) -D -m 0755 $(@D)/amavutils/libamavutils.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amadec/libamadec.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(STAGING_DIR)/usr/lib
Full destination path needed.
Quoted 1 line
+
Unneeded empty line (already mentioned by Vicente)
package/libamcodec/libamcodec.mk line 30
Quoted 8 lines
package/libamcodec/libamcodec.mk new file +8
-0+ mkdir -p $(STAGING_DIR)/usr/include/amcodec + cp -rf $(@D)/amcodec/include/* $(STAGING_DIR)/usr/include/amcodec +endef + +define LIBAMCODEC_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/amavutils/libamavutils.so $(TARGET_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amadec/libamadec.so $(TARGET_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(TARGET_DIR)/usr/lib
Full destination path needed.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/1 libamcodec: New Package
Greetings,
Quoted 26 lines
Hello,
Thanks for this new iteration!
Quoted 7 lines · Dagg
+-CPP=g++ +-AS=as +-AR=ar +-LD=ld +-NM=nm +-STRIP=strip +-OBJCOPY=objcopyQuoted 7 lines
++CPP ?= g++
++AS ?= as
++AR ?= ar
++LD ?= ld
++NM ?= nm
++STRIP ?= strip
++OBJCOPY ?= objcopyThis patch would not be needed if $(TARGET_CONFIGURE_OPTS) was passed as a make option instead of in the make environment. I.e
$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS)
Quoted 7 lines
instead of
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE)However, this also means that a number of other variables from your package
Makefilewill be overridden, such as CFLAGS, CXXFLAGS, LDFLAGS, etc. This sometimes causes some problems.
seems like I've encountered such an issue,
using the format above resulted in missing includes error, e.g. local paths are not part of the flags. what is the proper way to fix it?
Quoted 16 lines
package/libamcodec/Config.in line 2
Quoted 3 lines
package/libamcodec/Config.in new file +2
-0+comment "libamcodec needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADSYou need to replicate the architecture dependency here, so that the comment is not needlessly displayed on architectures for which the libamcodec option will anyway not be available, regardless of the availability of thread support.
package/libamcodec/libamcodec.mk line 11
Quoted 5 lines
package/libamcodec/libamcodec.mk new file +5
-0+LIBAMCODEC_VERSION = ed1d8b8c54b05c1a02a8ee44c59744e4cbed3d8d +LIBAMCODEC_SITE = $(call github,mdrjr,c2_aml_libs,$(LIBAMCODEC_VERSION)) +LIBAMCODEC_DEPENDENCIES = alsa-lib + +# this pkg uses a non standard prefix vars, so we need to use them.# This package uses the
M_PREFIXvariable to construct the header and
Quoted 4 lines
# library paths used when compiling.is probably a slightly better explanation.
correct, done.
Quoted 4 lines
Quoted 4 lines
package/libamcodec/libamcodec.mk new file +4
-0+define LIBAMCODEC_BUILD_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/amavutils M_PREFIX="$(STAGING_DIR)/usr" + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/amadec M_PREFIX="$(STAGING_DIR)/usr" + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/amcodec PREFIX="$(STAGING_DIR)"
Quoted 9 lines
package/libamcodec/libamcodec.mk line 21
Quoted 6 lines
package/libamcodec/libamcodec.mk new file +6
-0+endef + +define LIBAMCODEC_INSTALL_STAGING_CMDS + $(INSTALL) -D -m 0755 $(@D)/amavutils/libamavutils.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amadec/libamadec.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(STAGING_DIR)/usr/libFull destination path needed.
not sure what you mean by Full destination path needed, can you elaborate please?
Quoted 4 lines
Quoted 1 line
+
Unneeded empty line (already mentioned by Vicente)
done.
Quoted 11 lines
package/libamcodec/libamcodec.mk line 30
Quoted 8 lines
package/libamcodec/libamcodec.mk new file +8
-0+ mkdir -p $(STAGING_DIR)/usr/include/amcodec + cp -rf $(@D)/amcodec/include/* $(STAGING_DIR)/usr/include/amcodec +endef + +define LIBAMCODEC_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/amavutils/libamavutils.so $(TARGET_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amadec/libamadec.so $(TARGET_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(TARGET_DIR)/usr/libFull destination path needed.
the same as above.
Quoted 3 lines
Thanks,
Thomas
Dagg.
PATCH v2 1/1 libamcodec: New Package
Hello,
Quoted 6 lines · daggs
Quoted 3 lines
However, this also means that a number of other variables from your package
Makefilewill be overridden, such as CFLAGS, CXXFLAGS, LDFLAGS, etc. This sometimes causes some problems.seems like I've encountered such an issue,
using the format above resulted in missing includes error, e.g. local paths are not part of the flags. what is the proper way to fix it?
In the package Makefile, whenever there is:
CFLAGS = foo
LDFLAGS = foo
change it to:
override CFLAGS += foo
override LDFLAGS += foo
Quoted 7 lines
Quoted 6 lines
package/libamcodec/libamcodec.mk line 21
Quoted 3 lines
package/libamcodec/libamcodec.mk new file +3
-0+ $(INSTALL) -D -m 0755 $(@D)/amavutils/libamavutils.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amadec/libamadec.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(STAGING_DIR)/usr/libFull destination path needed.
not sure what you mean by Full destination path needed, can you elaborate please?
$(STAGING_DIR)/usr/lib/libavmavutils.so
as opposed to
$(STAGING_DIR)/usr/lib
as you're doing currently.
If you do:
$(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(STAGING_DIR)/usr/lib
and $(STAGING_DIR)/usr/lib doesn't already exists as a directory, then libamcodec.so will be copied as a file named "lib" under $(STAGING_DIR)/usr.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/1 libamcodec: New Package
Greetings,
Quoted 13 lines
Hello,
Quoted 6 lines · daggs
Quoted 3 lines
However, this also means that a number of other variables from your package
Makefilewill be overridden, such as CFLAGS, CXXFLAGS, LDFLAGS, etc. This sometimes causes some problems.seems like I've encountered such an issue,
using the format above resulted in missing includes error, e.g. local paths are not part of the flags. what is the proper way to fix it?In the package
Makefile, whenever there is:
Quoted 7 lines
CFLAGS = foo
LDFLAGS = foochange it to:
override CFLAGS += foo
override LDFLAGS += foo
thanks, it worked for amavutils and amadec.
the problem is with amcodec which doesn't seems to respect it.
from what I can understand, the makefile do does this: include $(SRCTREE)/rules.mk and in rules.mk I see that it does this: $(MAKE) -C ${1} -f ${SRCTREE}/depends.mk;\
this seems to reverts the CFLAGS and LDFLAGS back to their default. have you encountered such issue before?
Quoted 21 lines
Quoted 8 lines
Quoted 7 lines
package/libamcodec/libamcodec.mk line 21
Quoted 4 lines
package/libamcodec/libamcodec.mk new file +3
-0+ $(INSTALL) -D -m 0755 $(@D)/amavutils/libamavutils.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amadec/libamadec.so $(STAGING_DIR)/usr/lib + $(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(STAGING_DIR)/usr/libFull destination path needed.
not sure what you mean by Full destination path needed, can you elaborate please?
$(STAGING_DIR)/usr/lib/libavmavutils.soas opposed to
$(STAGING_DIR)/usr/libas you're doing currently.
If you do:
$(INSTALL) -D -m 0555 $(@D)/amcodec/libamcodec.so $(STAGING_DIR)/usr/lib
Quoted 7 lines
and $(STAGING_DIR)/usr/lib doesn't already exists as a directory, then libamcodec.so will be copied as a file named "lib" under $(STAGING_DIR)/usr.
Best regards,
Thomas
done.