gforth/Makefile |
6 | 6 | |
7 | 7 | PKG_NAME:=gforth |
8 | 8 | PKG_VERSION:=0.7.0-20100725 |
9 | | PKG_RELEASE:=3 |
| 9 | PKG_RELEASE:=4 |
10 | 10 | |
11 | 11 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz |
12 | 12 | PKG_SOURCE_URL:=http://mosquito.dyndns.tv/~spock/ |
13 | 13 | PKG_MD5SUM:=f030bdfe42a9be32889d5b4c8cb37856 |
14 | 14 | |
15 | | PKG_BUILD_DEPENDS:= gforth/host libldtl/host |
| 15 | PKG_BUILD_DEPENDS:= gforth/host libltdl/host |
16 | 16 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) |
17 | 17 | |
18 | | include $(INCLUDE_DIR)/package.mk |
19 | 18 | include $(INCLUDE_DIR)/host-build.mk |
| 19 | include $(INCLUDE_DIR)/package.mk |
20 | 20 | |
21 | 21 | # for now: override download and use local gforth sources |
22 | 22 | # remove the prepare.stamp if updating tgz |
... | ... | |
44 | 44 | |
45 | 45 | HOST_CONFIGURE_VARS += LTDL_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib |
46 | 46 | |
47 | | # found this in the libtool Makefile. does it help us? |
48 | | #export GLOBAL_LIBDIR=$(STAGING_DIR)/usr/lib |
| 47 | ## The host-GForth uses -ltdl to link against the staging dir version of |
| 48 | ## libltdl. However, when the host-GForth runs, it won't find that library, |
| 49 | ## as no library path is encoded into the ltdl dependency (why?). So here we |
| 50 | ## override LD_LIBRARY_PATH for all the build steps that might run the |
| 51 | ## host-GForth. |
49 | 52 | |
50 | 53 | define Host/Configure |
51 | | export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib; $(call Host/Configure/Default) |
| 54 | export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib; \ |
| 55 | $(call Host/Configure/Default) |
52 | 56 | endef |
53 | 57 | |
54 | | # define Host/Compile |
55 | | # $(MAKE) -C $(HOST_BUILD_DIR) |
56 | | # endef |
| 58 | define Host/Compile |
| 59 | export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib; \ |
| 60 | $(call Host/Compile/Default) |
| 61 | endef |
57 | 62 | |
58 | | # define Host/Install |
59 | | # $(MAKE) -C $(HOST_BUILD_DIR) \ |
60 | | # DESTDIR="$(STAGING_DIR_HOST)" \ |
61 | | # install |
62 | | # endef |
| 63 | define Host/Install |
| 64 | export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib; \ |
| 65 | $(call Host/Install/Default) |
| 66 | endef |
63 | 67 | |
64 | 68 | # todo: skipcode= |
65 | 69 | # todo: compiler options / tuning (openwrt sets bad defaults?) |
| 70 | # todo: either gcc 3.4 or -Os makes primitives use doubly-indirect dispatch :( |
66 | 71 | |
| 72 | CROSS_PREFORTH=$(PKG_BUILD_DIR)/preforth |
| 73 | |
| 74 | ## here we call configure, then patch the cross-GForth source tree to replace |
| 75 | ## the 'preforth' script with a script that calls our host-compiled GForth |
67 | 76 | define Build/Configure |
68 | 77 | $(call Build/Configure/Default,) |
69 | | echo "#!/bin/sh" > $(PKG_BUILD_DIR)/preforth |
70 | | echo '$(STAGING_DIR_HOST)/bin/gforth -i $(STAGING_DIR_HOST)/lib/gforth/$(PKG_VERSION)/gforth.fi "$$$$@"' >> $(PKG_BUILD_DIR)/preforth |
| 78 | echo "#!/bin/sh" > $(CROSS_PREFORTH) |
| 79 | echo "export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib;" >> $(CROSS_PREFORTH) |
| 80 | echo '$(STAGING_DIR_HOST)/bin/gforth -i $(STAGING_DIR_HOST)/lib/gforth/$(PKG_VERSION)/gforth.fi "$$$$@"' >> $(CROSS_PREFORTH) |
71 | 81 | chmod a+x $(PKG_BUILD_DIR)/preforth |
72 | 82 | endef |
73 | 83 | |
| 84 | ## Compilation is pretty manual to only build the parts we need. By default |
| 85 | ## the GForth Makefile attempts to auto-tune by recursively calling itself for |
| 86 | ## compilation, then running the GForth binary through unit-tests. This won't |
| 87 | ## work with a cross-compile environment |
74 | 88 | define Build/Compile |
75 | 89 | $(MAKE) -C $(PKG_BUILD_DIR) kernel/version.fs gforth-ditc \ |
76 | 90 | engine/prim-fast.i engine/prim_lab-fast.i engine/prim_names-fast.i \ |
... | ... | |
84 | 98 | cp engine/gforth-fast-ll-reg ./gforth-fast |
85 | 99 | endef |
86 | 100 | |
| 101 | ## |
| 102 | ## define lists of GForth's sources to package for loading in the target system |
| 103 | ## |
| 104 | |
87 | 105 | STARTUP = exboot.fs startup.fs arch/mips/asm.fs arch/mips/disasm.fs |
88 | 106 | |
89 | 107 | GFORTH_FI_SRC = \ |