pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS

Difference between
modified post 23bb94 by Anonymous on Mon 5th Feb 2024 14:32
original post b4678 by Anonymous on Mon 5th Feb 2024 09:41
Download diff
Show old version | new version | both versions

    
11
#
22
# ksh93.cygport
33
#
44
# Copyright (C) 2024 Roland Mainz <roland.mainz@nrubsig.org>
55
#
66
# This file is free software; I give unlimited permission to copy and/or
77
# distribute it, with or without modifications, as long as this notice is
88
# preserved.
99
#
1010
1111
NAME=astksh
1212
LICENSE="Eclipse Public License - v 2.0"
1313
HOMEPAGE="https://github.com/ksh93/ksh"
1414
VERSION=1.0.8
1515
RELEASE=0
1616
1717
PKG_NAMES="astksh astksh_devel"
1818
1919
astksh_SUMMARY="The AT&T Korn Shell"
2020
astksh_DESCRIPTION="Original version of the AT&T AST Korn Shell 93."
2121
astksh_CATEGORY="Base Shells"
2222
astksh_CONTENTS=" \
2323
	bin/ksh.exe \
2424
	bin/ksh93.exe \
2525
	bin/rksh.exe \
2626
	bin/rksh93.exe \
2727
	etc/ksh.kshrc \
28-
	usr/share/doc/ksh \
28+
	usr/share/doc/astksh \
2929
	usr/share/man/man1 \
3030
"
3131
3232
astksh_devel_SUMMARY="Development files for AT&T ksh"
3333
astksh_devel_DESCRIPTION="This package contains development tools and scripts for AT&T ksh"
3434
astksh_devel_CATEGORY="Devel"
3535
astksh_devel_CONTENTS="usr/share/ksh \
3636
	bin/shcomp.exe \
3737
"
3838
3939
SRC_URI="https://github.com/ksh93/ksh/archive/refs/tags/v1.0.8.zip"
4040
SRC_DIR='./ksh-1.0.8/'
4141
PATCH_URI_BASE=""
4242
4343
BUILD_REQUIRES=" \
4444
    bash \
4545
    coreutils \
4646
    bison \
4747
    gcc-g++ \
4848
    libiconv-devel \
4949
    libintl-devel \
5050
    libncurses-devel \
5151
    make \
5252
    sed \
5353
    texinfo \
5454
"
5555
5656
CPPFLAGS=
5757
CYGCONF_ARGS=
5858
DIFF_EXCLUDES=
5959
DOCS=
6060
6161
function print_gnulinux_builtin_header
6262
{
6363
# Make sure to use \\ instead of \ for continuations
6464
cat <<ENDOFTEXT
6565
6666
#ifndef _GNULINUX_KSH_CMDLIST_H
6767
#define        _GNULINUX_KSH_CMDLIST_H
6868
6969
#ifdef __cplusplus
7070
extern "C" {
7171
#endif
7272
7373
/*
7474
 * List builtins for Linux.
7575
 * The list here is partially autogenerated and partially hand-picked
7676
 * based on compatibility with the native GNU coreutils versions of
7777
 * these tools
7878
 */
7979
8080
/* GNU coreutils compatible commands.
8181
 * Be careful, some are in /bin while others are in /usr/bin
8282
 */
8383
#define	ASTCMDLIST(f) \
8484
	{ "/usr/ast/bin/"	#f,	NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
8585
#define	BINCMDLIST(f)	\
8686
	{ "/bin/"		#f,	NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) }, \
8787
	{ "/usr/bin/"		#f,	NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
8888
/* undo ast_map.h #defines to avoid collision */
8989
#undef basename
9090
#undef chmod
9191
#undef chown
9292
#undef dirname
9393
#undef mkdir
9494
#undef mkfifo
9595
#undef mktemp
9696
#undef readlink
9797
#undef realpath
9898
#undef rmdir
9999
100100
101101
/* Generated data, do not edit. */
102102
BINCMDLIST(basename)
103103
BINCMDLIST(cksum)
104104
BINCMDLIST(comm)
105105
BINCMDLIST(cut)
106106
BINCMDLIST(dirname)
107107
BINCMDLIST(expr)
108108
BINCMDLIST(fold)
109109
BINCMDLIST(join)
110110
BINCMDLIST(logname)
111111
BINCMDLIST(mkdir)
112112
BINCMDLIST(mkfifo)
113113
BINCMDLIST(mktemp)
114114
BINCMDLIST(paste)
115115
BINCMDLIST(pathchk)
116116
BINCMDLIST(rev)
117117
BINCMDLIST(rmdir)
118118
BINCMDLIST(sleep)
119119
BINCMDLIST(sync)
120120
BINCMDLIST(tee)
121121
BINCMDLIST(tty)
122122
BINCMDLIST(uniq)
123123
BINCMDLIST(wc)
124124
125125
/* Mandatory for ksh93 test suite and AST scripts */
126126
BINCMDLIST(getconf)
127127
128128
ASTCMDLIST(basename)
129129
ASTCMDLIST(cat)
130130
ASTCMDLIST(chgrp)
131131
ASTCMDLIST(chmod)
132132
ASTCMDLIST(chown)
133133
ASTCMDLIST(cksum)
134134
ASTCMDLIST(cmp)
135135
ASTCMDLIST(comm)
136136
ASTCMDLIST(cp)
137137
ASTCMDLIST(cut)
138138
ASTCMDLIST(date)
139139
ASTCMDLIST(dirname)
140140
//BINCMDLIST(egrep)
141141
//ASTCMDLIST(egrep)
142142
ASTCMDLIST(expr)
143143
ASTCMDLIST(fds)
144144
//BINCMDLIST(fgrep)
145145
//ASTCMDLIST(fgrep)
146146
ASTCMDLIST(fmt)
147147
ASTCMDLIST(fold)
148148
//BINCMDLIST(grep)
149149
//ASTCMDLIST(grep)
150150
ASTCMDLIST(head)
151151
ASTCMDLIST(id)
152152
//BINCMDLIST(iconv)
153153
//ASTCMDLIST(iconv)
154154
ASTCMDLIST(join)
155155
ASTCMDLIST(ln)
156156
ASTCMDLIST(logname)
157157
//ASTCMDLIST(ls)
158158
ASTCMDLIST(md5sum)
159159
BINCMDLIST(md5sum)
160160
ASTCMDLIST(mkdir)
161161
ASTCMDLIST(mkfifo)
162162
ASTCMDLIST(mktemp)
163163
ASTCMDLIST(mv)
164164
ASTCMDLIST(paste)
165165
ASTCMDLIST(pathchk)
166166
ASTCMDLIST(pids)
167167
//BINCMDLIST(od)
168168
//ASTCMDLIST(od)
169169
//BINCMDLIST(readlink)
170170
//ASTCMDLIST(readlink)
171171
//BINCMDLIST(realpath)
172172
//ASTCMDLIST(realpath)
173173
ASTCMDLIST(rev)
174174
ASTCMDLIST(rm)
175175
ASTCMDLIST(rmdir)
176176
ASTCMDLIST(stty)
177177
//ASTCMDLIST(sha1sum)
178178
//BINCMDLIST(sha1sum)
179179
//ASTCMDLIST(sha256sum)
180180
//BINCMDLIST(sha256sum)
181181
//ASTCMDLIST(sha384sum)
182182
//BINCMDLIST(sha384sum)
183183
//ASTCMDLIST(sha512sum)
184184
//BINCMDLIST(sha512sum)
185185
ASTCMDLIST(sum)
186186
ASTCMDLIST(sync)
187187
ASTCMDLIST(tail)
188188
ASTCMDLIST(tee)
189189
//BINCMDLIST(tr)
190190
//ASTCMDLIST(tr)
191191
ASTCMDLIST(tty)
192192
ASTCMDLIST(uname)
193193
ASTCMDLIST(uniq)
194194
//ASTCMDLIST(vmstate)
195195
ASTCMDLIST(wc)
196196
// ASTCMDLIST(xgrep)
197197
//BINCMDLIST(xargs)
198198
//ASTCMDLIST(xargs)
199199
200200
#ifdef __cplusplus
201201
}
202202
#endif
203203
204204
#endif /* !_GNULINUX_KSH_CMDLIST_H */
205205
ENDOFTEXT
206206
	return 0
207207
}
208208
209209
src_compile()
210210
{
211211
	cd ${S}
212212
213213
	#
214214
	# prepare build
215215
	#
216216
217217
	# translate cygport ARCH to AST hosttype
218218
	if [[ "$ARCH" == 'i686' ]] ; then
219219
		ast_hosttype='cygwin.i386'
220220
	elif [[ "$ARCH" == 'x86_64' ]] ; then
221221
		ast_hosttype='cygwin.i386-64'
222222
	else
223223
		false
224224
	fi
225225
226226
	gnulinux_builtin_header="${PWD}/tmp_gnulinux_builtin_header.h"
227227
	print_gnulinux_builtin_header >"${gnulinux_builtin_header}"
228228
229229
	# ksh93+AST config flags
230230
	bast_flags="-DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\"/usr/ast/bin\\\" -DSHOPT_CMDLIB_HDR=\\\"${gnulinux_builtin_header}\\\" -DSHOPT_SYSRC"
231231
232232
	# build debug
233233
	#export IFFEFLAGS=-d1
234234
235235
	# fix build issues with mkfifo
236236
	sed -i -r 's/mkfifo.+?(-m [[:digit:]]+)/mkfifo /g' ./src/cmd/INIT/package.sh ./bin/package
237237
238238
239239
	#
240240
	# build AT&T AST ksh
241241
	#
242242
	if [[ "$ARCH" == 'i686' ]] ; then
243243
   		     export SHELL=/bin/bash HOSTTYPE="${ast_hosttype}"; \
244244
			/bin/bash ./bin/package make \
245245
				CC="/usr/bin/gcc -m32 -std=gnu17" CCFLAGS="-Os -g ${bast_flags}" SHELL="$SHELL" HOSTTYPE="$HOSTTYPE"
246246
	elif [[ "$ARCH" == 'x86_64' ]] ; then
247247
		export SHELL=/bin/bash HOSTTYPE="${ast_hosttype}"; \
248248
			/bin/bash ./bin/package make \
249249
				CC="/usr/bin/gcc -m64 -std=gnu17" CCFLAGS="-Os -g ${bast_flags}" SHELL="$SHELL" HOSTTYPE="$HOSTTYPE"
250250
	else
251251
		# unsupported arch!
252252
		false
253253
	fi
254254
255255
256256
	#
257257
	# create ksh.kshrc
258258
	#
259259
	{
260260
		printf '#\n# /etc/ksh.kshrc+~/.kshrc are sourced only for interactive shells\n#\n\n'
261+
		printf '# default prompt\n'
261262
		printf 'PS1=%q\n' $'\E[32m$(/usr/bin/logname)@$(/usr/bin/hostname) \E[33m${PWD/~(Sl-r)$HOME/"~"}\E[0m\n$ '
263+
		printf '# default editor mode\n'
262265
	} >${S}/etc_ksh_kshrc
263266
}
264267
265268
#
266269
# install ksh, rksh, shcomp
267270
#
268271
src_install()
269272
{
270273
	if [[ "$ARCH" == 'i686' ]] ; then
271274
		ast_hosttype='cygwin.i386'
272275
	elif [[ "$ARCH" == 'x86_64' ]] ; then
273276
		ast_hosttype='cygwin.i386-64'
274277
	else
275278
		false
276279
	fi
277280
278281
	/usr/bin/install -D -m0755 ${S}/arch/${ast_hosttype}/bin/ksh.exe ${D}/bin/ksh.exe
279282
	ln ${D}/bin/ksh.exe ${D}/bin/rksh.exe
280283
	ln ${D}/bin/ksh.exe ${D}/bin/ksh93.exe
281284
	ln ${D}/bin/ksh.exe ${D}/bin/rksh93.exe
282285
	/usr/bin/install -D -m0755 ${S}/arch/${ast_hosttype}/bin/ksh.exe ${D}/bin/shcomp.exe
283286
	/usr/bin/install -D -m0644 ${S}/arch/${ast_hosttype}/man/man1/sh.1 ${D}/usr/share/man/man1/ksh.1
284287
	/usr/bin/install -D -m0644 ${S}/etc_ksh_kshrc ${D}/etc/ksh.kshrc
285288
286289
	for i in ${S}/src/cmd/ksh93/tests/* ; do
287290
		/usr/bin/install -D -m0644 $i ${D}/usr/share/ksh/tests/$(basename "$i")
288291
	done
289292
}
290293
291294
CYGWIN_MAINTAINER=Roland%20Mainz
292295
CYGWIN_MAINTAINER_EMAIL=roland.mainz@nrubsig.org
293296
294297
CYGWIN_CO_MAINTAINER=Cedric%20Blancher
295298
CYGWIN_CO_MAINTAINER_EMAIL=cedric.blancher@gmail.com
296299
297300
# EOF.
298301

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at