Hi All,

I've packaged up a very small implementation of scheme called
TinyScheme as well as an extension module called TSX (TinyScheme
Extensions). I'll try to package up a bit more up in the days to come
like a regex module and the ability to use scheme embedded in text
files with <? ?> tags or the like. I hope someone else finds this
useful.

Thanks,
Dave

---

Signed-off-by: David Cooper <d...@kupesoft.com>

Index: packages/lang/tinyscheme/patches/01-dynload-path.patch
===================================================================
--- packages/lang/tinyscheme/patches/01-dynload-path.patch      (revision 0)
+++ packages/lang/tinyscheme/patches/01-dynload-path.patch      (revision 0)
@@ -0,0 +1,19 @@
+diff -ruN tinyscheme1.39.orig/dynload.c tinyscheme1.39/dynload.c
+--- tinyscheme1.39.orig/dynload.c      2004-06-07 09:56:52.000000000 -0400
++++ tinyscheme1.39/dynload.c   2009-03-11 18:27:59.000000000 -0400
+@@ -122,8 +122,13 @@
+   return(retval);

+ }

+

+-static void make_filename(const char *name, char *filename) {

+- strcpy(filename,name);

++static void make_filename(const char *name, char *filename) {
++#ifdef ExtDir
++ strcpy(filename,ExtDir);
++ strcat(filename,name);
++#else

++ strcpy(filename,name);
++#endif

+  strcat(filename,SUFFIX);

+ }

+

Index: packages/lang/tinyscheme/Makefile
===================================================================
--- packages/lang/tinyscheme/Makefile   (revision 0)
+++ packages/lang/tinyscheme/Makefile   (revision 0)
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2009 David Cooper <d...@kupesoft.com>
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tinyscheme
+PKG_VERSION:=1.39
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).zip
+PKG_SOURCE_URL:=...@sf/tinyscheme
+PKG_MD5SUM:=55523524236ba546fdaf5f6b96a49a2b
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tinyscheme
+  SUBMENU:=TinyScheme
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=A minimal implementation of scheme
+  URL:=http://tinyscheme.sourceforge.net/
+endef
+
+define Package/tinyscheme/description
+ TinyScheme is a lightweight Scheme interpreter that implements
+ as large a subset of R5RS as was possible without getting very
+ large and complicated. It is meant to be used as an embedded
+ scripting interpreter for other programs. As such, it does not
+ offer IDEs or extensive toolkits although it does sport a small
+ top-level loop, included conditionally. As an embedded interpreter,
+ it allows multiple interpreter states to coexist in the same
+ program, without any interference between them. Programmatically,
+ foreign functions in C can be added and values can be defined in
+ the Scheme environment. Being a quite small program, it is easy
+ to comprehend, get to grips with, and use.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC) $(TARGET_CFLAGS)" \
+               FEATURES="-DUSE_DL=1 -DUSE_PLIST=1 \
+                       -DInitFile=\"\\\"/usr/share/tinyscheme/init.scm\\\"\" \
+                       -DExtDir=\"\\\"/usr/lib/tinyscheme/\\\"\"" \
+               SYS_LIBS="-ldl -lm" \
+               scheme
+endef
+
+define Build/InstallDev
+       mkdir -p $(1)/usr/include/tinyscheme
+       $(CP) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/tinyscheme
+endef
+
+define Package/tinyscheme/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scheme $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/share/tinyscheme
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/init.scm $(1)/usr/share/tinyscheme
+endef
+
+$(eval $(call BuildPackage,tinyscheme))
+
Index: packages/lang/tinyscheme-tsx/patches/01-cross-compile.patch
===================================================================
--- packages/lang/tinyscheme-tsx/patches/01-cross-compile.patch (revision 0)
+++ packages/lang/tinyscheme-tsx/patches/01-cross-compile.patch (revision 0)
@@ -0,0 +1,24 @@
+diff -ruN tsx-1.1.orig/Makefile tsx-1.1/Makefile
+--- tsx-1.1.orig/Makefile      2002-04-09 04:37:57.000000000 -0400
++++ tsx-1.1/Makefile   2009-03-11 17:54:11.000000000 -0400
+@@ -3,14 +3,15 @@
+ SCHEME_H_DIR=..
+ CC=gcc
+ CFLAGS=-DUSE_DL=1 -I $(SCHEME_H_DIR)
++FPIC=-fPIC
+
+ tsx.so : tsx.c tsx.h Makefile
+-      $(CC) -shared -Wall -fPIC $(CFLAGS) -o tsx.so $(DEBUG) tsx.c
+-      strip tsx.so
+-      ls -l tsx.so
++      $(CC) -shared -Wall $(FPIC) $(CFLAGS) -o tsx.so $(DEBUG) tsx.c
++#     strip tsx.so
++#     ls -l tsx.so
+
+ .PHONY : clean
+ clean:
+       rm -f *.o
+       rm -f tsx.so
+-      rm -f *~
+\ No newline at end of file
++      rm -f *~
Index: packages/lang/tinyscheme-tsx/Makefile
===================================================================
--- packages/lang/tinyscheme-tsx/Makefile       (revision 0)
+++ packages/lang/tinyscheme-tsx/Makefile       (revision 0)
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2009 David Cooper <d...@kupesoft.com>
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tinyscheme-tsx
+PKG_VERSION:=1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=tsx-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://heras-gilsanz.com/manuel/
+PKG_MD5SUM:=34bb54737e8603ed981bd186121b1606
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/tsx-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tinyscheme-tsx
+  SUBMENU:=TinyScheme
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Tinyscheme extensions (files, sockets, time, misc)
+  URL:=http://heras-gilsanz.com/manuel/tsx.html
+  DEPENDS:=+tinyscheme
+endef
+
+define Package/tinyscheme-tsx/description
+ The Tinyscheme extensions (TSX) are a set of extensions for
+ the TinyScheme implementation of the Scheme programming
+ language. TSX provides support for operations with
+ filesystem, sockets, date/time, and some miscellaneous ones.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" FPIC="$(FPIC)" CFLAGS="$(TARGET_CFLAGS) \
+                       -DUSE_DL=1 -I $(STAGING_DIR)/usr/include/tinyscheme"
+endef
+
+define Package/tinyscheme-tsx/install
+       $(INSTALL_DIR) $(1)/usr/lib/tinyscheme
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/tsx.so $(1)/usr/lib/tinyscheme
+endef
+
+$(eval $(call BuildPackage,tinyscheme-tsx))
+
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to