-
Notifications
You must be signed in to change notification settings - Fork 756
interpreters: add Tcl support #3646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+127
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| if(CONFIG_INTERPRETERS_JIMTCL) | ||
| set(JIMTCL_VERSION 0.83) | ||
| set(JIMTCL_TARBALL ${JIMTCL_VERSION}.tar.gz) | ||
| set(JIMTCL_UNPACK jimtcl) | ||
| set(JIMTCL_URL_BASE https://github.com/msteveb/jimtcl/archive/refs/tags) | ||
| set(JIMTCL_URL ${JIMTCL_URL_BASE}/${JIMTCL_TARBALL}) | ||
| set(JIMTCL_SRC ${CMAKE_CURRENT_BINARY_DIR}/${JIMTCL_UNPACK}) | ||
|
|
||
| # We need the source available before declaring the application, because | ||
| # jimsh.c is added as an application source, so we can not integrate download | ||
| # into the external project. | ||
| FetchContent_Declare(jimtcl_fetch URL ${JIMTCL_URL} SOURCE_DIR | ||
| ${JIMTCL_UNPACK}) | ||
|
|
||
| FetchContent_MakeAvailable(jimtcl_fetch) | ||
|
|
||
| ExternalProject_Add( | ||
| jimtcl_build | ||
| SOURCE_DIR ${JIMTCL_SRC} | ||
| PATCH_COMMAND sed -i -e "/^void Jim_SetEnviron/,/^/{s/^/\\/* /}" -e | ||
| "/^void Jim_SetEnviron/,/^/{s/\$/ *\\//}" jim.c | ||
| CONFIGURE_COMMAND | ||
| ./configure --host=${CMAKE_C_COMPILER_TARGET} | ||
| "CFLAGS=$<JOIN:$<TARGET_PROPERTY:apps_jimsh,COMPILE_OPTIONS>, > -D$<JOIN:$<TARGET_PROPERTY:apps_jimsh,COMPILE_DEFINITIONS>, -D> -I$<JOIN:$<TARGET_PROPERTY:apps_jimsh,INCLUDE_DIRECTORIES>, -I> -isystem ${CMAKE_SOURCE_DIR}/include -isystem ${CMAKE_BINARY_DIR}/include" | ||
| BUILD_COMMAND make libjim.a initjimsh.o | ||
| INSTALL_COMMAND "" | ||
| BUILD_IN_SOURCE TRUE | ||
| BUILD_BYPRODUCTS ${JIMTCL_SRC}/libjim.a ${JIMTCL_SRC}/_initjimsh.c) | ||
|
|
||
| nuttx_add_application( | ||
| NAME | ||
| jimsh | ||
| PRIORITY | ||
| 100 | ||
| STACKSIZE | ||
| 8192 | ||
| INCLUDE_DIRECTORIES | ||
| ${JIMTCL_SRC} | ||
| DEPENDS | ||
| jimtcl_build | ||
| SRCS | ||
| ${JIMTCL_SRC}/jimsh.c | ||
| ${JIMTCL_SRC}/_initjimsh.c) | ||
|
|
||
| set_property(GLOBAL APPEND PROPERTY NUTTX_EXTRA_LIBRARIES | ||
| ${JIMTCL_SRC}/libjim.a) | ||
|
|
||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # | ||
| # For a description of the syntax of this configuration file, | ||
| # see the file kconfig-language.txt in the NuttX tools repository. | ||
| # | ||
|
|
||
| config INTERPRETERS_JIMTCL | ||
| bool "The Jim (TCL) Interpreter" | ||
| default n | ||
| ---help--- | ||
| Enable support for The Jim interpreter. | ||
| Jim is an opensource small-footprint implementation of the | ||
| Tcl programming language. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ifneq ($(CONFIG_INTERPRETERS_JIMTCL),) | ||
| CONFIGURED_APPS += $(APPDIR)/interpreters/jimtcl | ||
| endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| include $(APPDIR)/Make.defs | ||
|
|
||
| PROGNAME = jimsh | ||
| PRIORITY = 100 | ||
| STACKSIZE = 8192 | ||
|
|
||
| JIMTCL_VERSION = 0.83 | ||
| JIMTCL_TARBALL = $(JIMTCL_VERSION).tar.gz | ||
| JIMTCL_UNPACK = jimtcl | ||
| JIMTCL_URL_BASE = https://github.com/msteveb/jimtcl/archive/refs/tags | ||
|
acassis marked this conversation as resolved.
|
||
| JIMTCL_URL = $(JIMTCL_URL_BASE)/$(JIMTCL_TARBALL) | ||
| JIMTCL_SRC = $(JIMTCL_UNPACK) | ||
|
|
||
| MAINSRC = $(JIMTCL_SRC)$(DELIM)jimsh.c | ||
|
|
||
| # Obtain object list from jimtcl Makefile | ||
| JIMTCL_OBJS := $(shell test -f $(JIMTCL_SRC)$(DELIM)Makefile \ | ||
| && ( cat $(JIMTCL_SRC)$(DELIM)Makefile; \ | ||
| printf 'print-%%:\n\techo $$($$*)' ) \ | ||
| | $(MAKE) -f - -s print-OBJS) initjimsh.o | ||
|
|
||
| EXTOBJS = $(addprefix $(JIMTCL_SRC)$(DELIM), $(JIMTCL_OBJS)) | ||
|
|
||
| CFLAGS += -I$(JIMTCL_SRC) | ||
|
|
||
| $(JIMTCL_SRC)$(DELIM)%.o: $(JIMTCL_SRC)$(DELIM)Makefile | ||
| $(Q) $(MAKE) -C $(JIMTCL_SRC) $*.o | ||
|
|
||
| $(JIMTCL_SRC)$(DELIM)jimsh.c: $(JIMTCL_SRC)$(DELIM)Makefile | ||
|
|
||
| $(JIMTCL_SRC)$(DELIM)_initjimsh.c: $(JIMTCL_SRC)$(DELIM)Makefile | ||
| $(Q) $(MAKE) -C $(JIMTCL_SRC) $(notdir $@) | ||
|
|
||
| $(JIMTCL_SRC)$(DELIM)Makefile: | ||
| $(Q) cd $(dir $@) \ | ||
| && ./configure --host=$(patsubst %-,%,$(CROSSDEV)) \ | ||
| CFLAGS="$(CFLAGS)" | ||
|
|
||
| # Get the source code and apply a small patch because environ is | ||
| # not settable in Nuttx. This is not required for basic jimtcl | ||
| # but build would fail without commenting it out. | ||
| $(JIMTCL_TARBALL): | ||
| $(Q) echo "Downloading $(JIMTCL_TARBALL)" | ||
| $(Q) curl -O -L $(JIMTCL_URL) | ||
| $(Q) echo "Unpacking $(JIMTCL_TARBALL) to $(JIMTCL_UNPACK)" | ||
| $(Q) tar -xvzf $(JIMTCL_TARBALL) | ||
| $(Q) mv jimtcl-$(JIMTCL_VERSION) $(JIMTCL_UNPACK) | ||
| $(Q) sed -i '/^void Jim_SetEnviron/,/^}/{s/^/\/* /;s/$$/ *\//}' \ | ||
| $(JIMTCL_SRC)$(DELIM)jim.c | ||
|
|
||
| # Download and unpack tarball if no git repo found | ||
| ifeq ($(wildcard $(JIMTCL_UNPACK)/.git),) | ||
| context:: $(JIMTCL_TARBALL) | ||
| endif | ||
|
|
||
| clean:: | ||
| $(Q) test -f $(JIMTCL_SRC)$(DELIM)Makefile \ | ||
| && $(MAKE) -C $(JIMTCL_SRC) clean | ||
|
|
||
| distclean:: clean | ||
| $(call DELDIR, $(JIMTCL_UNPACK)) | ||
| $(call DELFILE, $(JIMTCL_TARBALL)) | ||
|
|
||
| include $(APPDIR)/Application.mk | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.