kumquat-buildroot/package/gerbera/gerbera.mk
Fabrice Fontaine c68efce50c package/gerbera: fix build with -Os and gcc 9 or 10
For an unknown reason, gerbera fails to build with -Os and gcc 9 or 10
since bump to version 1.8.0 in commit 8974596836:

[100%] Linking CXX executable gerbera
/home/giuliobenetti/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-gnu/10.2.0/../../../../x86_64-buildroot-linux-gnu/bin/ld: liblibgerbera.a(content_manager.cc.o): in function `ContentManager::_rescanDirectory(std::shared_ptr<AutoscanDirectory>&, int, std::shared_ptr<GenericTask> const&)':
content_manager.cc:(.text+0xb53b): undefined reference to `std::__shared_ptr<std::filesystem::__cxx11::_Dir, (__gnu_cxx::_Lock_policy)2>::swap(std::__shared_ptr<std::filesystem::__cxx11::_Dir, (__gnu_cxx::_Lock_policy)2>&)'
collect2: error: ld returned 1 exit status

A similar build failure has been reported as gcc bug 91067:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91067

But this bug has been fixed since gcc 9.3 and 10.1 and build failures
are raised with gcc 10.2

To fix this build failure, set optimisation to -O2 if needed

Fixes:
 - http://autobuild.buildroot.org/results/a4ee8ad7ff93939716673b611c7cc3f68dafa3d0

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-05-18 15:14:26 +02:00

134 lines
3.2 KiB
Makefile

################################################################################
#
# gerbera
#
################################################################################
GERBERA_VERSION = 1.8.1
GERBERA_SITE = $(call github,gerbera,gerbera,v$(GERBERA_VERSION))
GERBERA_LICENSE = GPL-2.0
GERBERA_LICENSE_FILES = LICENSE.md
GERBERA_DEPENDENCIES = \
fmt \
host-pkgconf \
pugixml \
spdlog \
sqlite \
util-linux \
zlib
GERBERA_CONF_OPTS = -DWITH_DEBUG=OFF
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_9)$(BR2_OPTIMIZE_S),yy)
GERBERA_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -O2"
endif
# Uses __atomic_fetch_add_4
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
GERBERA_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
endif
ifeq ($(BR2_PACKAGE_DUKTAPE),y)
GERBERA_DEPENDENCIES += duktape
GERBERA_CONF_OPTS += -DWITH_JS=ON
else
GERBERA_CONF_OPTS += -DWITH_JS=OFF
endif
ifeq ($(BR2_PACKAGE_EXIV2),y)
GERBERA_DEPENDENCIES += exiv2
GERBERA_CONF_OPTS += -DWITH_EXIV2=ON
else
GERBERA_CONF_OPTS += -DWITH_EXIV2=OFF
endif
ifeq ($(BR2_PACKAGE_FFMPEG),y)
GERBERA_DEPENDENCIES += ffmpeg
GERBERA_CONF_OPTS += -DWITH_AVCODEC=ON
else
GERBERA_CONF_OPTS += -DWITH_AVCODEC=OFF
endif
ifeq ($(BR2_PACKAGE_FILE),y)
GERBERA_DEPENDENCIES += file
GERBERA_CONF_OPTS += -DWITH_MAGIC=ON
else
GERBERA_CONF_OPTS += -DWITH_MAGIC=OFF
endif
ifeq ($(BR2_PACKAGE_LIBCURL),y)
GERBERA_DEPENDENCIES += libcurl
GERBERA_CONF_OPTS += -DWITH_CURL=ON
else
GERBERA_CONF_OPTS += -DWITH_CURL=OFF
endif
ifeq ($(BR2_PACKAGE_LIBEXIF),y)
GERBERA_DEPENDENCIES += libexif
GERBERA_CONF_OPTS += -DWITH_EXIF=ON
else
GERBERA_CONF_OPTS += -DWITH_EXIF=OFF
endif
ifeq ($(BR2_PACKAGE_LIBICONV),y)
GERBERA_DEPENDENCIES += libiconv
endif
ifeq ($(BR2_PACKAGE_LIBMATROSKA),y)
GERBERA_DEPENDENCIES += libmatroska
GERBERA_CONF_OPTS += -DWITH_MATROSKA=ON
else
GERBERA_CONF_OPTS += -DWITH_MATROSKA=OFF
endif
# Either libupnp or libnpupnp are guranteed to be enabled
ifeq ($(BR2_PACKAGE_LIBNPUPNP),y)
GERBERA_DEPENDENCIES += libnpupnp
GERBERA_CONF_OPTS += -DWITH_NPUPNP=ON
else
GERBERA_DEPENDENCIES += libupnp
GERBERA_CONF_OPTS += -DWITH_NPUPNP=OFF
endif
ifeq ($(BR2_PACKAGE_MYSQL),y)
GERBERA_DEPENDENCIES += mysql
GERBERA_CONF_OPTS += -DWITH_MYSQL=ON
else
GERBERA_CONF_OPTS += -DWITH_MYSQL=OFF
endif
ifeq ($(BR2_PACKAGE_SYSTEMD),y)
GERBERA_DEPENDENCIES += systemd
GERBERA_CONF_OPTS += -DWITH_SYSTEMD=ON
else
GERBERA_CONF_OPTS += -DWITH_SYSTEMD=OFF
endif
ifeq ($(BR2_PACKAGE_TAGLIB),y)
GERBERA_DEPENDENCIES += taglib
GERBERA_CONF_OPTS += -DWITH_TAGLIB=ON
else
GERBERA_CONF_OPTS += -DWITH_TAGLIB=OFF
endif
# gerbera does not provide a default configuration file, it can be
# created during run time through --create-config:
# http://docs.gerbera.io/en/latest/config-overview.html#generating-configuration
# However, to have a correct home directory and UDN, install it ourself
define GERBERA_INSTALL_CONFIGURATION
$(INSTALL) -D -m 0644 package/gerbera/config.xml \
$(TARGET_DIR)/etc/gerbera/config.xml
endef
GERBERA_POST_INSTALL_TARGET_HOOKS += GERBERA_INSTALL_CONFIGURATION
define GERBERA_USERS
gerbera -1 gerbera -1 * /var/lib/gerbera - - Gerbera user
endef
define GERBERA_INSTALL_INIT_SYSV
$(INSTALL) -D -m 0755 package/gerbera/S99gerbera \
$(TARGET_DIR)/etc/init.d/S99gerbera
endef
$(eval $(cmake-package))