aboutsummaryrefslogtreecommitdiff
path: root/libs/slang2/Makefile
blob: 28affd96c27687a9336377eb56050624e5ba141a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#
# 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:=5

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-or-later
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>

PKG_BUILD_PARALLEL:=0
PKG_CONFIG_DEPENDS:=CONFIG_BUILD_NLS

SLANG_MODULES:= base64 chksum csv fcntl fork histogram iconv json onig pcre \
	png rand select slsmg socket stats sysconf termios varray zlib

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.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-iconv
$(call Package/libslang2/Default)
  TITLE+= (iconv module)
  DEPENDS:=$(ICONV_DEPENDS)
endef

define Package/libslang2-mod-onig
$(call Package/libslang2/Default)
  TITLE+= (onig module)
  DEPENDS:=+oniguruma
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 \
	$(if $(CONFIG_BUILD_NLS),--with-iconv=$(ICONV_PREFIX)) \
	--with-onig="$(STAGING_DIR)/usr" \
	--with-pcre="$(STAGING_DIR)/usr" \
	--with-png="$(STAGING_DIR)/usr" \
	--with-z="$(STAGING_DIR)/usr" \
	--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))