slang: Add new package
authorJeffery To <redacted>
Tue, 30 Apr 2019 12:29:43 +0000 (20:29 +0800)
committerJeffery To <redacted>
Tue, 14 May 2019 05:55:21 +0000 (13:55 +0800)
From the S-Lang website:
S-Lang is a multi-platform programmer's library designed to allow a
developer to create robust multi-platform software. It provides
facilities required by interactive applications such as display/screen
management, keyboard input, keymaps, and so on. The most exciting
feature of the library is the slang interpreter that may be easily
embedded into a program to make it extensible. While the emphasis has
always been on the embedded nature of the interpreter, it may also be
used in a stand-alone fashion through the use of slsh, which is part of
the S-Lang distribution.

Adapted from the old packages feed:
https://git.openwrt.org/?p=openwrt/svn-archive/packages.git;a=tree;f=libs/slang2

Signed-off-by: Jeffery To <redacted>
libs/slang2/Makefile [new file with mode: 0644]
libs/slang2/patches/001-skip-terminfo-dir-test.patch [new file with mode: 0644]
libs/slang2/patches/002-use-target-ar.patch [new file with mode: 0644]

diff --git a/libs/slang2/Makefile b/libs/slang2/Makefile
new file mode 100644 (file)
index 0000000..568af53
--- /dev/null
@@ -0,0 +1,176 @@
+#
+# Copyright (C) 2006-2011 Openwrt.org
+# Copyright (C) 2011 SMBPhone Inc.
+# Copyright (C) 2019 Jeffery To
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=slang
+PKG_VERSION:=2.3.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://www.jedsoft.org/releases/slang \
+       https://www.jedsoft.org/releases/slang/old
+PKG_HASH:=fc9e3b0fc4f67c3c1f6d43c90c16a5c42d117b8e28457c5b46831b8b5d3ae31a
+
+PKG_LICENSE:=GPL-2.0+
+PKG_LICENSE_FILES:=COPYING
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+
+PKG_BUILD_PARALLEL:=1
+
+SLANG_MODULES:= base64 chksum csv fcntl fork histogram iconv json pcre png \
+       rand select slsmg socket stats sysconf termios varray zlib
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libslang2/Default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=S-Lang Programmer's Library
+  URL:=https://www.jedsoft.org/slang/
+endef
+
+define Package/libslang2/Default/description
+  Multi-platform programmer's library providing facilities for interactive
+  applications.  Includes such things as display/screen management,
+  keyboard input, keymaps, etc.  Includes the embeddable S-Lang interpreter.
+endef
+
+define Package/libslang2
+$(call Package/libslang2/Default)
+  DEPENDS:=+terminfo
+endef
+
+define Package/libslang2/description
+$(call Package/libslang2/Default/description)
+endef
+
+define Package/libslang2-modules
+$(call Package/libslang2/Default)
+  TITLE+= (all modules)
+  DEPENDS:=$(foreach mod,$(SLANG_MODULES),+libslang2-mod-$(mod))
+endef
+
+define Package/libslang2-modules/description
+$(call Package/libslang2/Default/description)
+
+  This installs all of S-Lang's bundled modules.
+endef
+
+define Package/libslang2-mod-pcre
+$(call Package/libslang2/Default)
+  TITLE+= (pcre module)
+  DEPENDS:=+libpcre
+endef
+
+define Package/libslang2-mod-png
+$(call Package/libslang2/Default)
+  TITLE+= (png module)
+  DEPENDS:=+libpng
+endef
+
+define Package/libslang2-mod-zlib
+$(call Package/libslang2/Default)
+  TITLE+= (zlib module)
+  DEPENDS:=+zlib
+endef
+
+define Package/slsh
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=S-Lang shell
+  URL:=https://www.jedsoft.org/slang/slsh.html
+  DEPENDS:=+libslang2 +libslang2-modules
+endef
+
+define Package/slsh/description
+  This is a shell which is mostly just a wrapper around the S-Lang Interpreter,
+  which is part of the S-Lang Library.
+endef
+
+TARGET_CFLAGS+= $(FPIC)
+
+CONFIGURE_ARGS+= \
+       --enable-largefile \
+       --enable-warnings \
+       --with-terminfo=default \
+       --with-readline=slang \
+       --with-pcre="$(STAGING_DIR)/usr" \
+       --with-png="$(STAGING_DIR)/usr" \
+       --with-z="$(STAGING_DIR)/usr" \
+       --without-onig \
+       --without-x
+
+define Build/Compile
+       $(call Build/Compile/Default,)
+       $(call Build/Compile/Default,static)
+endef
+
+# Default install last, so that the dynamic slsh is installed
+define Build/Install
+       $(call Build/Install/Default,install-static)
+       $(call Build/Install/Default,)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libslang.{a,so*} $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/slang.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libslang2/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libslang.so* $(1)/usr/lib/
+endef
+
+Package/libslang2-modules/install:=:
+
+define Package/slsh/install
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/slsh.rc $(1)/etc/
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/slsh $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/slsh/ $(1)/usr/share/
+endef
+
+define BuildModule
+  ifndef Package/libslang2-mod-$(1)
+    define Package/libslang2-mod-$(1)
+    $$(call Package/libslang2/Default)
+      TITLE+= ($(1) module)
+    endef
+  endif
+
+  define Package/libslang2-mod-$(1)/description
+  $$(call Package/libslang2/Default/description)
+
+    This contains the $(1) module.
+  endef
+
+  define Package/libslang2-mod-$(1)/install
+       $$(INSTALL_DIR) $$(1)/usr/lib/slang/v2/modules
+       $$(CP) $$(PKG_INSTALL_DIR)/usr/lib/slang/v2/modules/$(1)-module.so $$(1)/usr/lib/slang/v2/modules/
+  endef
+
+  $$(eval $$(call BuildPackage,libslang2-mod-$(1)))
+endef
+
+$(foreach mod,$(SLANG_MODULES),$(eval $(call BuildModule,$(mod))))
+
+$(eval $(call BuildPackage,libslang2))
+$(eval $(call BuildPackage,libslang2-modules))
+$(eval $(call BuildPackage,slsh))
diff --git a/libs/slang2/patches/001-skip-terminfo-dir-test.patch b/libs/slang2/patches/001-skip-terminfo-dir-test.patch
new file mode 100644 (file)
index 0000000..e56fa77
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure
++++ b/configure
+@@ -7029,7 +7029,7 @@ TERMCAP=-ltermcap
+ for terminfo_dir in $JD_Terminfo_Dirs
+ do
+-   if test -d $terminfo_dir
++   if true
+    then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; }
diff --git a/libs/slang2/patches/002-use-target-ar.patch b/libs/slang2/patches/002-use-target-ar.patch
new file mode 100644 (file)
index 0000000..d2ef8bb
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -73,7 +73,7 @@ INSTALL_DATA = @INSTALL_DATA@
+ MKINSDIR      = @CONFIG_DIR@/autoconf/mkinsdir.sh
+ RM            = rm -f
+ RM_R          = rm -rf
+-AR_CR                 = ar cr
++AR_CR                 = $(AR) cr
+ RMDIR                 = rmdir
+ LN            = /bin/ln -sf
+ CP            = cp
git clone https://git.99rst.org/PROJECT