1
votes

I'm trying to figure out if it's possible to cross compile a program with Scons for a target running OpenWRT. I'm trying to avoid rewriting the make files since I already have the sconscript set up and the program depends on many includes and libraries from different directories. Unclear to me if it's possible to do using the OpenWRT Toolchain or SDK, I couldn't find any examples online.

Any examples would be much appreciated.

2
What do you need to do to setup to use the toolchain? What platform does openwrt toolchain run on ? - bdbaddog
Did you find a solution yet? - KingsInnerSoul

2 Answers

0
votes

I made this Makefile template based on IoTivity Mafile:

include $(TOPDIR)/rules.mk

PKG_NAME:=foobar
PKG_VERSION:=1.0.0
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://mirrors.foo.bar.io/$(PKG_NAME)/$(PKG_VERSION)/
PKG_MD5SUM:=7ddf32e17a6ac5ce04a8ecbf782ca509

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/scons.mk

define Package/foobar
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=FooBar
  URL:=https://foobar.io
endef

define Build/Configure
(cd $(PKG_BUILD_DIR); \
    $(SCONS_VARS) \
    scons \
    $(SCONS_OPTIONS) \
)
endef

define Package/foobar/install
    $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/foobar $(1)/usr/bin/
endef

$(eval $(call BuildPackage,foobar))
0
votes

You can use the --cc and --cxx options from scons