X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/64f1ed8de7026752f2b306797226b932e386b4b5..ce2d16c92003a345ccced4b0ced57dc13d3dddd4:/package/grub/Makefile diff --git a/package/grub/Makefile b/package/grub/Makefile index 221269ba4..80b79f29e 100644 --- a/package/grub/Makefile +++ b/package/grub/Makefile @@ -44,6 +44,19 @@ CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS) CONFIGURE_VARS += $(MY_CONFIGURE_VARS) +ifeq ($(HOST_OS),Darwin) + HOST_CFLAGS += $(call host-cc-option,-m32) + HOST_CFLAGS += $(call host-cc-option,-fnested-functions) +endif + +ifeq ($(HOST_OS),FreeBSD) + ifeq ($(HOST_ARCH),amd64) + HOST_CFLAGS += $(call host-cc-option,-m32) + HOST_CFLAGS += $(call host-cc-option,-B/usr/lib32) + HOST_CFLAGS += $(call host-cc-option,-L/usr/lib32) + endif +endif + HOST_CFLAGS += $(call host-cc-option,-fno-stack-protector) HOST_CFLAGS += $(call host-cc-option,-U_FORTIFY_SOURCE) @@ -53,6 +66,22 @@ HOST_CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS) \ HOST_CONFIGURE_VARS += $(MY_CONFIGURE_VARS) +define Host/Configure + (cd $(HOST_BUILD_DIR); aclocal && autoconf && automake) + $(call Host/Configure/Default) +endef + +ifeq ($(HOST_OS),Darwin) + define Host/Compile + $(MAKE) -C $(HOST_BUILD_DIR)/lib + $(MAKE) -C $(HOST_BUILD_DIR)/stage2 libgrub.a + $(MAKE) -C $(HOST_BUILD_DIR)/grub + endef + define Host/Install + $(MAKE) -C $(HOST_BUILD_DIR)/grub install + endef +endif + define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/grub $(1)/usr/lib/ @@ -67,5 +96,16 @@ define Package/grub/install $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ endef +ifeq ($(HOST_ARCH),x86_64) + define Require/working-gcc-m32 + echo 'int main(int argc, char **argv) { return 0; }' | \ + gcc -x c -o $(TMP_DIR)/a.out - -m32 -lc + endef +endif + +$(eval $(call Require,working-gcc-m32, \ + Please install 32 bit development files. (gcc-multilib on Debian/Ubuntu, gcc.i686, libgcc.i686, and glibc-devel.i686 on CentOS/Fedora/RHEL) \ +)) + $(eval $(call HostBuild)) $(eval $(call BuildPackage,grub))