buildroot/package/ficl/ficl.mk
Francois Perrad 128a16acee ficl: fix build with gcc 7
gcc 7 with -Os (optimize for size) takes the liberty to remove the code
of inline functions entirely - which is indeed allowed according to the
C99 standard, cfr. this [1] very complete StackOverflow answer. This
leads to undefined function references at link time.

The proper approach is to patch the code to use 'static inline'
instead. However, for various reasons such a patch is not entirely
trivial, and upstream has not moved since 7 years, so instead take the
simpler approach of restoring the gcc original inline behaviour with
-fgnu89-inline to fix this issue.

Fixes http://autobuild.buildroot.org/results/d72/d72a7e9775a10bc884b9953dd2eba3ad32100cca

[1] https://stackoverflow.com/questions/6312597/is-inline-without-static-or-extern-ever-useful-in-c99

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2017-08-09 23:41:51 +02:00

60 lines
1.9 KiB
Makefile

################################################################################
#
# ficl
#
################################################################################
FICL_VERSION_MAJOR = 4.1
FICL_VERSION = $(FICL_VERSION_MAJOR).0
FICL_SITE = http://downloads.sourceforge.net/project/ficl/ficl-all/ficl$(FICL_VERSION_MAJOR)
FICL_LICENSE = BSD-2-Clause
FICL_LICENSE_FILES = ReadMe.txt
FICL_INSTALL_STAGING = YES
ifeq ($(BR2_STATIC_LIBS),y)
FICL_BUILD_TARGETS += ficl
define FICL_INSTALL_STATIC_BIN
$(INSTALL) -D -m 0755 $(@D)/ficl $(TARGET_DIR)/usr/bin/ficl
endef
endif
ifeq ($(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
FICL_BUILD_TARGETS += libficl.a
define FICL_INSTALL_STATIC_LIB
$(INSTALL) -D -m 0644 $(@D)/libficl.a $(STAGING_DIR)/usr/lib/libficl.a
endef
endif
ifeq ($(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
FICL_BUILD_TARGETS += main libficl.so.$(FICL_VERSION)
define FICL_INSTALL_SHARED_BIN
$(INSTALL) -D -m 0755 $(@D)/main $(TARGET_DIR)/usr/bin/ficl
endef
define FICL_INSTALL_SHARED_LIB
$(INSTALL) -D -m 0755 $(@D)/libficl.so.$(FICL_VERSION) $(1)/usr/lib/libficl.so.$(FICL_VERSION)
ln -sf libficl.so.$(FICL_VERSION) $(1)/usr/lib/libficl.so.4
ln -sf libficl.so.$(FICL_VERSION) $(1)/usr/lib/libficl.so
endef
endif
define FICL_BUILD_CMDS
$(MAKE) -C $(@D) -f Makefile.linux $(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS) -fgnu89-inline -fPIC -I. -Dlinux" CPPFLAGS="" $(FICL_BUILD_TARGETS)
endef
define FICL_INSTALL_STAGING_CMDS
$(FICL_INSTALL_STATIC_LIB)
$(call FICL_INSTALL_SHARED_LIB,$(STAGING_DIR))
$(INSTALL) -D -m 0644 $(@D)/ficl.h $(STAGING_DIR)/usr/include/ficl.h
$(INSTALL) -D -m 0644 $(@D)/ficllocal.h $(STAGING_DIR)/usr/include/ficllocal.h
$(INSTALL) -D -m 0644 $(@D)/ficlplatform/unix.h $(STAGING_DIR)/usr/include/ficlplatform/unix.h
endef
define FICL_INSTALL_TARGET_CMDS
$(FICL_INSTALL_STATIC_BIN)
$(FICL_INSTALL_SHARED_BIN)
$(call FICL_INSTALL_SHARED_LIB,$(TARGET_DIR))
endef
$(eval $(generic-package))