################################################################################
#
# fusescript buildroot package
#
################################################################################
FUSESCRIPT_VERSION = 1.0
FUSESCRIPT_SITE = https://github.com/vi/fusescript 
FUSESCRIPT_LICENSE = GPL-2.0+
FUSESCRIPT_SITE = /buildroot-v86/package/fusescript
FUSESCRIPT_SITE_METHOD = local
FUSESCRIPT_INSTALL_STAGING = YES
FUSESCRIPT_DEPENDENCIES = libfuse3

# We need to override the C compiler used in the Makefile to 
# use buildroot's cross-compiler instead of cc.  Switch cc to $(CC)
# so we can override the variable via env vars.
define FUSESCRIPT_MAKEFILE_FIXUP
  echo no fixup
endef

FUSESCRIPT_PRE_BUILD_HOOKS += FUSESCRIPT_MAKEFILE_FIXUP

define FUSESCRIPT_BUILD_CMDS
	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) LDOPTIONS="-lfuse3" LIBS="$(TARGET_CFLAGS) -lfuse3"
endef

define FUSESCRIPT_INSTALL_TARGET_CMDS
	$(INSTALL) -D -m 0755 $(@D)/fusescript $(TARGET_DIR)/usr/bin/fusescript
endef

define FUSESCRIPT_INSTALL_STAGING_CMDS
	$(INSTALL) -D -m 0755 $(@D)/fusescript $(STAGING_DIR)/usr/bin/fusescript
endef

$(eval $(generic-package))