pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS

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

    
11
#
22
# ksh93.cygport
33
#
4-
# Copyright (C) 2024, Roland Mainz <roland.mainz@nrubsig.org>
4+
# 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
11-
NAME=ksh
11+
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
17-
PKG_NAMES="ksh ksh_devel"
17+
PKG_NAMES="astksh astksh_devel"
1818
19-
ksh_SUMMARY="The AT&T Korn Shell"
19+
astksh_SUMMARY="The AT&T Korn Shell"
20-
ksh_DESCRIPTION="Original version of the AT&T AST Korn Shell 93."
20+
astksh_DESCRIPTION="Original version of the AT&T AST Korn Shell 93."
21-
ksh_CATEGORY="Base Shells"
21+
astksh_CATEGORY="Base Shells"
22-
ksh_CONTENTS=" \
22+
astksh_CONTENTS=" \
2323
	bin/ksh.exe \
2424
	bin/ksh93.exe \
2525
	bin/rksh.exe \
2626
	bin/rksh93.exe \
2727
	etc/ksh.kshrc \
2828
	usr/share/doc/ksh \
2929
	usr/share/man/man1 \
3030
"
3131
32-
ksh_devel_SUMMARY="Development files for AT&T ksh"
32+
astksh_devel_SUMMARY="Development files for AT&T ksh"
33-
ksh_devel_DESCRIPTION="This package contains development tools and scripts for AT&T ksh"
33+
astksh_devel_DESCRIPTION="This package contains development tools and scripts for AT&T ksh"
34-
ksh_devel_CATEGORY="Devel"
34+
astksh_devel_CATEGORY="Devel"
35-
ksh_devel_CONTENTS="usr/share/ksh \
35+
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"
40+
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
61-
src_compile()
61+
function print_gnulinux_builtin_header
6262
{
63-
	cd ${S}
63+
# Make sure to use \\ instead of \ for continuations
64+
cat <<ENDOFTEXT
6465
65-
	# fix build issues with mkfifo
66+
#ifndef _GNULINUX_KSH_CMDLIST_H
66-
	sed -i -r 's/mkfifo.+?(-m [[:digit:]]+)/mkfifo /g' ./src/cmd/INIT/package.sh ./bin/package
67+
#define        _GNULINUX_KSH_CMDLIST_H
6768
68-
	# build ksh93
69+
#ifdef __cplusplus
69-
	if [[ "$ARCH" == 'i686' ]] ; then
70+
extern "C" {
70-
   		     export SHELL=/bin/bash HOSTTYPE="cygwin.i386"; \
71+
#endif
71-
			/bin/bash ./bin/package make \
72+
72-
				CC="/usr/bin/cc -std=gnu17" CCFLAGS="-Os -g" SHELL="$SHELL" HOSTTYPE="$HOSTTYPE"
73+
/*
73-
	elif [[ "$ARCH" == 'x86_64' ]] ; then
74+
 * List builtins for Linux.
74-
		export SHELL=/bin/bash HOSTTYPE="cygwin.i386-64"; \
75+
 * The list here is partially autogenerated and partially hand-picked
75-
			/bin/bash ./bin/package make \
76+
 * based on compatibility with the native GNU coreutils versions of
76-
				CC="/usr/bin/cc -std=gnu17" CCFLAGS="-Os -g" SHELL="$SHELL" HOSTTYPE="$HOSTTYPE"
77+
 * these tools
77-
	else
78+
 */
8179
82-
	# create ksh.kshrc
80+
/* GNU coreutils compatible commands.
83-
	{
81+
 * Be careful, some are in /bin while others are in /usr/bin
84-
		printf '#\n# /etc/ksh.kshrc+~/.kshrc are sourced only for interactive shells\n#\n\n'
82+
 */
85-
		printf 'PS1=%q\n' $'\E[32m$(/usr/bin/logname)@$(/usr/bin/hostname) \E[33m${PWD/~(Sl-r)$HOME/"~"}\E[0m\n$ '
83+
#define	ASTCMDLIST(f) \
86-
	} >${S}/etc_ksh_kshrc
84+
	{ "/usr/ast/bin/"	#f,	NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
87-
}
85+
#define	BINCMDLIST(f)	\
88-
86+
	{ "/bin/"		#f,	NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) }, \
89-
#
87+
	{ "/usr/bin/"		#f,	NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
90-
# install ksh, rksh, shcomp
88+
/* undo ast_map.h #defines to avoid collision */
91-
#
89+
#undef basename
92-
src_install()
90+
#undef chmod
93-
{
91+
#undef chown
94-
	/usr/bin/install -D -m0755 ${S}/arch/cygwin.i386-64/bin/ksh.exe ${D}/bin/ksh.exe
92+
#undef dirname
95-
	ln ${D}/bin/ksh.exe ${D}/bin/rksh.exe
93+
#undef mkdir
96-
	ln ${D}/bin/ksh.exe ${D}/bin/ksh93.exe
94+
#undef mkfifo
97-
	ln ${D}/bin/ksh.exe ${D}/bin/rksh93.exe
95+
#undef mktemp
98-
	/usr/bin/install -D -m0755 ${S}/arch/cygwin.i386-64/bin/ksh.exe ${D}/bin/shcomp.exe
96+
#undef readlink
99-
	/usr/bin/install -D -m0644 ${S}/arch/cygwin.i386-64/man/man1/sh.1 ${D}/usr/share/man/man1/ksh.1
97+
#undef realpath
100-
	/usr/bin/install -D -m0644 ${S}/etc_ksh_kshrc ${D}/etc/ksh.kshrc
98+
#undef rmdir
10199
106100
107-
CYGWIN_MAINTAINER=Roland%20Mainz
101+
/* Generated data, do not edit. */
108-
CYGWIN_MAINTAINER_EMAIL=roland.mainz@nrubsig.org
102+
BINCMDLIST(basename)
109-
103+
BINCMDLIST(cksum)
110-
CYGWIN_CO_MAINTAINER=Cedric%20Blancher
104+
BINCMDLIST(comm)
111-
CYGWIN_CO_MAINTAINER_EMAIL=cedric.blancher@gmail.com
105+
BINCMDLIST(cut)
112-
106+
BINCMDLIST(dirname)
113-
# EOF.
107+
BINCMDLIST(expr)
114-
108+
BINCMDLIST(fold)
115-
109+
BINCMDLIST(join)
116-
110+
BINCMDLIST(logname)
117-
111+
BINCMDLIST(mkdir)
118-
112+
BINCMDLIST(mkfifo)
119-
113+
BINCMDLIST(mktemp)
120-
114+
BINCMDLIST(paste)
121-
115+
BINCMDLIST(pathchk)
122-
116+
BINCMDLIST(rev)
123-
117+
BINCMDLIST(rmdir)
124-
118+
BINCMDLIST(sleep)
125-
119+
BINCMDLIST(sync)
126-
120+
BINCMDLIST(tee)
127-
121+
BINCMDLIST(tty)
128-
122+
BINCMDLIST(uniq)
129-
123+
BINCMDLIST(wc)
130124
131-
125+
/* Mandatory for ksh93 test suite and AST scripts */
132-
126+
BINCMDLIST(getconf)
133127
134-
128+
ASTCMDLIST(basename)
135-
129+
ASTCMDLIST(cat)
136-
130+
ASTCMDLIST(chgrp)
137-
131+
ASTCMDLIST(chmod)
138-
132+
ASTCMDLIST(chown)
139-
133+
ASTCMDLIST(cksum)
140-
134+
ASTCMDLIST(cmp)
141-
135+
ASTCMDLIST(comm)
142-
136+
ASTCMDLIST(cp)
143-
137+
ASTCMDLIST(cut)
144-
138+
ASTCMDLIST(date)
145-
139+
ASTCMDLIST(dirname)
146-
140+
//BINCMDLIST(egrep)
147-
141+
//ASTCMDLIST(egrep)
148-
142+
ASTCMDLIST(expr)
149-
143+
ASTCMDLIST(fds)
150-
144+
//BINCMDLIST(fgrep)
151-
145+
//ASTCMDLIST(fgrep)
152-
146+
ASTCMDLIST(fmt)
153-
147+
ASTCMDLIST(fold)
154-
148+
//BINCMDLIST(grep)
155-
149+
//ASTCMDLIST(grep)
156-
150+
ASTCMDLIST(head)
157-
151+
ASTCMDLIST(id)
158-
152+
//BINCMDLIST(iconv)
159-
153+
//ASTCMDLIST(iconv)
160-
154+
ASTCMDLIST(join)
161-
155+
ASTCMDLIST(ln)
162-
156+
ASTCMDLIST(logname)
163-
157+
//ASTCMDLIST(ls)
164-
158+
ASTCMDLIST(md5sum)
165-
159+
BINCMDLIST(md5sum)
166-
160+
ASTCMDLIST(mkdir)
167-
161+
ASTCMDLIST(mkfifo)
168-
162+
ASTCMDLIST(mktemp)
169-
163+
ASTCMDLIST(mv)
170-
164+
ASTCMDLIST(paste)
171-
165+
ASTCMDLIST(pathchk)
172-
166+
ASTCMDLIST(pids)
173-
167+
//BINCMDLIST(od)
174-
168+
//ASTCMDLIST(od)
175-
169+
//BINCMDLIST(readlink)
176-
170+
//ASTCMDLIST(readlink)
177-
171+
//BINCMDLIST(realpath)
178-
172+
//ASTCMDLIST(realpath)
179-
173+
ASTCMDLIST(rev)
180-
174+
ASTCMDLIST(rm)
181-
175+
ASTCMDLIST(rmdir)
182-
176+
ASTCMDLIST(stty)
183-
177+
//ASTCMDLIST(sha1sum)
184-
178+
//BINCMDLIST(sha1sum)
185-
179+
//ASTCMDLIST(sha256sum)
186-
180+
//BINCMDLIST(sha256sum)
187-
181+
//ASTCMDLIST(sha384sum)
188-
182+
//BINCMDLIST(sha384sum)
189-
183+
//ASTCMDLIST(sha512sum)
190-
184+
//BINCMDLIST(sha512sum)
191-
185+
ASTCMDLIST(sum)
192-
186+
ASTCMDLIST(sync)
193-
187+
ASTCMDLIST(tail)
194-
188+
ASTCMDLIST(tee)
195-
189+
//BINCMDLIST(tr)
196-
190+
//ASTCMDLIST(tr)
197-
191+
ASTCMDLIST(tty)
198-
192+
ASTCMDLIST(uname)
199-
193+
ASTCMDLIST(uniq)
200-
194+
//ASTCMDLIST(vmstate)
201-
195+
ASTCMDLIST(wc)
202-
196+
// ASTCMDLIST(xgrep)
203-
197+
//BINCMDLIST(xargs)
204-
198+
//ASTCMDLIST(xargs)
205199
206-
200+
#ifdef __cplusplus
207-
201+
}
208-
202+
#endif
209203
210-
204+
#endif /* !_GNULINUX_KSH_CMDLIST_H */
211-
205+
ENDOFTEXT
212-
206+
	return 0
213-
207+
}
214208
215-
209+
src_compile()
216-
210+
{
217-
211+
	cd ${S}
218212
219-
213+
	#
220-
214+
	# prepare build
221-
215+
	#
222216
223-
217+
	# translate cygport ARCH to AST hosttype
224-
218+
	if [[ "$ARCH" == 'i686' ]] ; then
225-
219+
		ast_hosttype='cygwin.i386'
226-
220+
	elif [[ "$ARCH" == 'x86_64' ]] ; then
227-
221+
		ast_hosttype='cygwin.i386-64'
228-
222+
	else
229-
223+
		false
230-
224+
	fi
231225
232-
226+
	gnulinux_builtin_header="${PWD}/tmp_gnulinux_builtin_header.h"
233-
227+
	print_gnulinux_builtin_header >"${gnulinux_builtin_header}"
234228
235-
229+
	# ksh93+AST config flags
236-
230+
	bast_flags="-DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\"/usr/ast/bin\\\" -DSHOPT_CMDLIB_HDR=\\\"${gnulinux_builtin_header}\\\" -DSHOPT_SYSRC"
237231
238-
232+
	# build debug
239-
233+
	#export IFFEFLAGS=-d1
240234
241-
235+
	# fix build issues with mkfifo
242-
236+
	sed -i -r 's/mkfifo.+?(-m [[:digit:]]+)/mkfifo /g' ./src/cmd/INIT/package.sh ./bin/package
243237
244238
245-
239+
	#
246-
240+
	# build AT&T AST ksh
247-
241+
	#
248-
242+
	if [[ "$ARCH" == 'i686' ]] ; then
249-
243+
   		     export SHELL=/bin/bash HOSTTYPE="${ast_hosttype}"; \
250-
244+
			/bin/bash ./bin/package make \
251-
245+
				CC="/usr/bin/gcc -m32 -std=gnu17" CCFLAGS="-Os -g ${bast_flags}" SHELL="$SHELL" HOSTTYPE="$HOSTTYPE"
252-
246+
	elif [[ "$ARCH" == 'x86_64' ]] ; then
253-
247+
		export SHELL=/bin/bash HOSTTYPE="${ast_hosttype}"; \
254-
248+
			/bin/bash ./bin/package make \
255-
249+
				CC="/usr/bin/gcc -m64 -std=gnu17" CCFLAGS="-Os -g ${bast_flags}" SHELL="$SHELL" HOSTTYPE="$HOSTTYPE"
256-
250+
	else
257-
251+
		# unsupported arch!
258-
252+
		false
259-
253+
	fi
260254
261255
262-
256+
	#
263-
257+
	# create ksh.kshrc
264-
258+
	#
265-
259+
	{
266-
260+
		printf '#\n# /etc/ksh.kshrc+~/.kshrc are sourced only for interactive shells\n#\n\n'
267-
261+
		printf 'PS1=%q\n' $'\E[32m$(/usr/bin/logname)@$(/usr/bin/hostname) \E[33m${PWD/~(Sl-r)$HOME/"~"}\E[0m\n$ '
268-
262+
	} >${S}/etc_ksh_kshrc
269-
263+
}
270264
271-
265+
#
272-
266+
# install ksh, rksh, shcomp
273-
267+
#
274-
268+
src_install()
275-
269+
{
276-
270+
	if [[ "$ARCH" == 'i686' ]] ; then
277-
271+
		ast_hosttype='cygwin.i386'
278-
272+
	elif [[ "$ARCH" == 'x86_64' ]] ; then
279-
273+
		ast_hosttype='cygwin.i386-64'
280-
274+
	else
281-
275+
		false
282-
276+
	fi
283277
284-
278+
	/usr/bin/install -D -m0755 ${S}/arch/${ast_hosttype}/bin/ksh.exe ${D}/bin/ksh.exe
285-
279+
	ln ${D}/bin/ksh.exe ${D}/bin/rksh.exe
286-
280+
	ln ${D}/bin/ksh.exe ${D}/bin/ksh93.exe
287-
281+
	ln ${D}/bin/ksh.exe ${D}/bin/rksh93.exe
288-
282+
	/usr/bin/install -D -m0755 ${S}/arch/${ast_hosttype}/bin/ksh.exe ${D}/bin/shcomp.exe
289-
283+
	/usr/bin/install -D -m0644 ${S}/arch/${ast_hosttype}/man/man1/sh.1 ${D}/usr/share/man/man1/ksh.1
290-
284+
	/usr/bin/install -D -m0644 ${S}/etc_ksh_kshrc ${D}/etc/ksh.kshrc
291285
292-
286+
	for i in ${S}/src/cmd/ksh93/tests/* ; do
293-
287+
		/usr/bin/install -D -m0644 $i ${D}/usr/share/ksh/tests/$(basename "$i")
294-
288+
	done
295-
289+
}
296290
297-
291+
CYGWIN_MAINTAINER=Roland%20Mainz
298-
292+
CYGWIN_MAINTAINER_EMAIL=roland.mainz@nrubsig.org
299293
300-
294+
CYGWIN_CO_MAINTAINER=Cedric%20Blancher
301-
295+
CYGWIN_CO_MAINTAINER_EMAIL=cedric.blancher@gmail.com
302296
303-
297+
# EOF.
304298

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