@@ -6,253 +6,104 @@ pkgdesc="The Original ATT Korn Shell, Now Maintained By The Community."
6
6
arch=(' i686' ' x86_64' )
7
7
url=" https://www.github.com/ksh93/ksh"
8
8
license=(' spdx:EPL-2.0' )
9
- makedepends=(' gcc' ' binutils' ' bison' ' libintl' ' ncurses-devel' ' texinfo' )
10
-
11
- # There exists already a package that provides ksh.exe, mksh, so I will set this to be a conflict.
12
- # Unless there can be a convincing reason to let both packages be installed.
9
+ makedepends=(' gcc' ' bison' ' libiconv-devel' ' gettext-devel' ' ncurses-devel' ' texinfo' )
10
+ depends=(' libiconv' )
13
11
conflicts=(' mksh' )
12
+ backup=(' etc/ksh.kshrc' )
14
13
15
14
source=(" ${pkgname} -${pkgver} .zip" ::https://github.com/ksh93/ksh/archive/refs/tags/v1.0.10.zip
16
- ' ksh.kshrc'
17
- ' ksh-unc-paths.patch' )
15
+ ' ksh.kshrc'
16
+ ' ksh-defpath-usr-bin.patch'
17
+ ' ksh-mamake.patch'
18
+ ' ksh-shtests-mkdir-m.patch'
19
+ ' ksh-unc-paths.patch' )
18
20
19
21
sha256sums=(' ab412118ce9527c6d805335080593fa874a0b859e9229c172f3fcf55d26f92e9'
20
- ' SKIP'
21
- ' 4838b950e32fc61dbfbb5e446570f4f7503f302a26305dff1f9b0769585a94bc' )
22
-
23
- # Special file suggested by another user on the github
24
- print_gnulinux_builtin_header () {
25
-
26
- # Make sure to use \\ instead of \ for continuations
27
- cat << ENDOFTEXT
28
-
29
- #ifndef _GNULINUX_KSH_CMDLIST_H
30
- #define _GNULINUX_KSH_CMDLIST_H
31
-
32
- #ifdef __cplusplus
33
- extern "C" {
34
- #endif
35
-
36
- /*
37
- * List builtins for Linux.
38
- * The list here is partially autogenerated and partially hand-picked
39
- * based on compatibility with the native GNU coreutils versions of
40
- * these tools
41
- */
42
-
43
- /* GNU coreutils compatible commands.
44
- * Be careful, some are in /bin while others are in /usr/bin
45
- */
46
- #define ASTCMDLIST(f) \
47
- { "/usr/ast/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
48
- #define BINCMDLIST(f) \
49
- { "/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) }, \
50
- { "/usr/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
51
- /* undo ast_map.h #defines to avoid collision */
52
- #undef basename
53
- #undef chmod
54
- #undef chown
55
- #undef dirname
56
- #undef mkdir
57
- #undef mkfifo
58
- #undef mktemp
59
- #undef readlink
60
- #undef realpath
61
- #undef rmdir
62
-
63
-
64
- /* Generated data, do not edit. */
65
- BINCMDLIST(basename)
66
- BINCMDLIST(cksum)
67
- BINCMDLIST(comm)
68
- BINCMDLIST(cut)
69
- BINCMDLIST(dirname)
70
- BINCMDLIST(expr)
71
- BINCMDLIST(fold)
72
- BINCMDLIST(join)
73
- BINCMDLIST(logname)
74
- BINCMDLIST(mkdir)
75
- BINCMDLIST(mkfifo)
76
- BINCMDLIST(mktemp)
77
- BINCMDLIST(paste)
78
- BINCMDLIST(pathchk)
79
- BINCMDLIST(rev)
80
- BINCMDLIST(rmdir)
81
- BINCMDLIST(sleep)
82
- BINCMDLIST(sync)
83
- BINCMDLIST(tee)
84
- BINCMDLIST(tty)
85
- BINCMDLIST(uniq)
86
- BINCMDLIST(wc)
87
-
88
- /* Mandatory for ksh93 test suite and AST scripts */
89
- BINCMDLIST(getconf)
90
-
91
- ASTCMDLIST(basename)
92
- ASTCMDLIST(cat)
93
- ASTCMDLIST(chgrp)
94
- ASTCMDLIST(chmod)
95
- ASTCMDLIST(chown)
96
- ASTCMDLIST(cksum)
97
- ASTCMDLIST(cmp)
98
- ASTCMDLIST(comm)
99
- ASTCMDLIST(cp)
100
- ASTCMDLIST(cut)
101
- ASTCMDLIST(date)
102
- ASTCMDLIST(dirname)
103
- //BINCMDLIST(egrep)
104
- //ASTCMDLIST(egrep)
105
- ASTCMDLIST(expr)
106
- ASTCMDLIST(fds)
107
- //BINCMDLIST(fgrep)
108
- //ASTCMDLIST(fgrep)
109
- ASTCMDLIST(fmt)
110
- ASTCMDLIST(fold)
111
- //BINCMDLIST(grep)
112
- //ASTCMDLIST(grep)
113
- ASTCMDLIST(head)
114
- ASTCMDLIST(id)
115
- //BINCMDLIST(iconv)
116
- //ASTCMDLIST(iconv)
117
- ASTCMDLIST(join)
118
- ASTCMDLIST(ln)
119
- ASTCMDLIST(logname)
120
- //ASTCMDLIST(ls)
121
- ASTCMDLIST(md5sum)
122
- BINCMDLIST(md5sum)
123
- ASTCMDLIST(mkdir)
124
- ASTCMDLIST(mkfifo)
125
- ASTCMDLIST(mktemp)
126
- ASTCMDLIST(mv)
127
- ASTCMDLIST(paste)
128
- ASTCMDLIST(pathchk)
129
- ASTCMDLIST(pids)
130
- //BINCMDLIST(od)
131
- //ASTCMDLIST(od)
132
- //BINCMDLIST(readlink)
133
- //ASTCMDLIST(readlink)
134
- //BINCMDLIST(realpath)
135
- //ASTCMDLIST(realpath)
136
- ASTCMDLIST(rev)
137
- ASTCMDLIST(rm)
138
- ASTCMDLIST(rmdir)
139
- ASTCMDLIST(stty)
140
- //ASTCMDLIST(sha1sum)
141
- //BINCMDLIST(sha1sum)
142
- //ASTCMDLIST(sha256sum)
143
- //BINCMDLIST(sha256sum)
144
- //ASTCMDLIST(sha384sum)
145
- //BINCMDLIST(sha384sum)
146
- //ASTCMDLIST(sha512sum)
147
- //BINCMDLIST(sha512sum)
148
- ASTCMDLIST(sum)
149
- ASTCMDLIST(sync)
150
- ASTCMDLIST(tail)
151
- ASTCMDLIST(tee)
152
- //BINCMDLIST(tr)
153
- //ASTCMDLIST(tr)
154
- ASTCMDLIST(tty)
155
- ASTCMDLIST(uname)
156
- ASTCMDLIST(uniq)
157
- //ASTCMDLIST(vmstate)
158
- ASTCMDLIST(wc)
159
- // ASTCMDLIST(xgrep)
160
- //BINCMDLIST(xargs)
161
- //ASTCMDLIST(xargs)
162
-
163
- #ifdef __cplusplus
164
- }
165
- #endif
166
-
167
- #endif /* !_GNULINUX_KSH_CMDLIST_H */
168
- ENDOFTEXT
169
- }
22
+ ' ed57db19753904b3969884f5768fa84d158f5ba65ba0766c095961cce0c8e267'
23
+ ' ca07713ffe1b4e2bafde1b3a5aa7ad112445f49f105388c5bb117d486953c3c7'
24
+ ' 49ff8cdfe5509846807db764f16ab321f431148c1d56f97c4843251a8f8bc109'
25
+ ' c7d1489142cbce27122fb11e506cf4b56459fc6803ec384bae52eaea8a012118'
26
+ ' 4838b950e32fc61dbfbb5e446570f4f7503f302a26305dff1f9b0769585a94bc' )
170
27
171
28
prepare () {
172
29
cd " ${srcdir} /ksh-${pkgver} "
173
30
patch -p1 -i ../ksh-unc-paths.patch
174
- export gnu_linux_builtin_header=" ${PWD} /tmp_gnulinux_builtin_header.h"
175
- print_gnulinux_builtin_header > " ${gnu_linux_builtin_header} "
31
+ patch -p1 -i ../ksh-defpath-usr-bin.patch
32
+ patch -p1 -i ../ksh-mamake.patch
33
+ patch -p1 -i ../ksh-shtests-mkdir-m.patch
176
34
}
177
35
178
- # Things might get a bit messary, prepare yourselves.
179
- # I really should use gisburn's kshrc default config.
180
36
build () {
181
- cd " ${srcdir} /ksh-${pkgver} "
182
-
183
- export BAST_FLAGS=" -DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\" /usr/ast/bin\\\" -DSHOPT_CMDLIB_HDR=\\\" ${gnu_linux_builtin_header} \\\" -DSHOPT_SYSRC"
184
-
185
- # For now, it literally fails if cc1.exe is not explicitly on the PATH.
186
- local GCC_DIR=" $( gcc -print-search-dirs | sed -ne ' /^install: /s///p' ) "
187
- export PATH=" $PATH :$GCC_DIR "
188
-
189
-
190
- # Additional weird workaround.
191
- export CFLAGS=" -I${GCC_DIR} /include -L${GCC_DIR} -L/usr/lib"
192
- export CCFLAGS=" ${CFLAGS} -I${scrdir} /ksh-${pkgver} -fno-use-linker-plugin ${BAST_FLAGS} -std=gnu17"
193
- export LIBRARY_PATH=" ${GCC_DIR} "
194
-
195
- # What the build system does by default is
196
- # entirely a shell script system. It sets 'chmod +x' to the script
197
- # but that does nothing with windows. Need to append
198
- # shebang at the start.
199
- sed -i ' 1s/^/#!\/usr\/bin\/bash\n/' src/cmd/INIT/mamprobe.sh
200
- sed -i ' 6s/^/#undef _lib_iconv_open\n/' src/lib/libast/features/iconv # Without this, fails with libiconv installed.
201
-
202
- # My previous attempt at patching the mamake.exe replacement failed. Reason being, is that
203
- # this build process is highly biased towards unix way of thinking, which doesn't work well with
204
- # windows. It might kinda work on cygwin, but that fails with msys2. The only successful way so far
205
- # it's been to build it, is to build it twice. Failure is expected.
206
-
207
- # First round. Note that '|| true' has to be there, it WILL bail the build process when the expected fork() issue
208
- # happens, so this tells bash to keep going anyways in spite of non zero return code.
209
- printf " If it reports back fork() error, this is to be expected.\n"
210
- printf " It will simply run the build command again to finish the job.\n"
211
- /usr/bin/bash bin/package make PACKAGEROOT=" $PWD " CC=" /usr/bin/gcc" SHELL=" /usr/bin/bash" || true
212
-
213
- sleep 2
214
-
215
- /usr/bin/bash bin/package make PACKAGEROOT=" $PWD " CC=" /usr/bin/gcc" SHELL=" /usr/bin/bash" || true
37
+ cd " ${srcdir} /ksh-${pkgver} "
216
38
39
+ CFLAGS+=" -fno-strict-aliasing -std=gnu17"
40
+ export CCFLAGS=" ${CFLAGS} "
41
+
42
+ # What the build system does by default is
43
+ # entirely a shell script system. It sets 'chmod +x' to the script
44
+ # but that does nothing with windows. Need to append
45
+ # shebang at the start.
46
+ sed -i ' 1s/^/#!\/usr\/bin\/bash\n/' src/cmd/INIT/mamprobe.sh
47
+
48
+ case " $CARCH " in
49
+ i? 86)
50
+ export HOSTTYPE=cygwin.i386
51
+ ;;
52
+ x86_64)
53
+ export HOSTTYPE=cygwin.i386-64
54
+ ;;
55
+ * )
56
+ echo " Unhandled architecture ${CARCH} " >&2
57
+ false
58
+ ;;
59
+ esac
60
+
61
+ # the brain-dead build system insists on setting CYGWIN=ntsec, even though
62
+ # the CYGWIN variable does nothing on MSYS2, and the ntsec option is obsolete
63
+ # and no longer does anything on Cygwin anyway
64
+ export CYGWIN=ntsec
65
+ bash bin/package make PACKAGEROOT=" $PWD " CC=" cc" SHELL=" /usr/bin/bash" HOSTTYPE=" ${HOSTTYPE} "
66
+ }
217
67
68
+ check () {
69
+ cd " ${srcdir} /ksh-${pkgver} "
70
+ bash bin/shtests --compile PACKAGEROOT=" $PWD " CC=" cc" HOSTTYPE=" ${HOSTTYPE} " || true
218
71
}
219
72
220
73
package () {
221
- cd " ${srcdir} "
222
- install -dm0755 " ${pkgdir} /etc/skel"
223
- install -dm0755 " ${pkgdir} /usr/share/ksh"
224
- install -dm0755 " ${pkgdir} /usr/share/doc/ksh"
225
- install -dm0755 " ${pkgdir} /usr/share/licenses/ksh"
226
-
227
- # Install the core components of ksh93
228
- cd " ${srcdir} /ksh-${pkgver} "
229
- /usr/bin/bash bin/package install CC=" /usr/bin/gcc" SHELL=" /usr/bin/bash" " ${pkgdir} /usr" PACKAGEROOT=" $PWD "
74
+ cd " ${srcdir} "
75
+ install -dm0755 " ${pkgdir} /etc/skel"
76
+ install -dm0755 " ${pkgdir} /usr/share/ksh"
77
+ install -dm0755 " ${pkgdir} /usr/share/doc/ksh"
78
+ install -dm0755 " ${pkgdir} /usr/share/licenses/ksh"
230
79
231
- # install ksh sample rc file
232
- install -Dm644 " ${srcdir} /ksh.kshrc" " ${pkgdir} /etc/ksh.kshrc"
80
+ # Install the core components of ksh93
81
+ cd " ${srcdir} /ksh-${pkgver} "
82
+ bash bin/package install CC=" cc" SHELL=" /usr/bin/bash" " ${pkgdir} /usr" PACKAGEROOT=" $PWD " HOSTTYPE=" ${HOSTTYPE} "
233
83
234
- # Install copyright and license files
235
- install -Dm0644 LICENSE.md " ${pkgdir} /usr/share/licenses/ksh/LICENSE.md"
236
- install -Dm0644 COPYRIGHT " ${pkgdir} /usr/share/licenses/ksh/COPYRIGHT"
84
+ # install ksh sample rc file
85
+ install -Dm644 " ${srcdir} /ksh.kshrc" " ${pkgdir} /etc/ksh.kshrc"
237
86
238
- local _docs
239
- for _docs in ' builtins.mm' ' COMPATIBILITY' ' DESIGN' ' OBSOLETE' ' PROMO.mm' ' README' ' README-AUDIT.md' \
240
- ' RELEASE' ' RELEASE88' ' RELEASE93' ' sh.memo' ' TYPES' ; do
241
- install -Dm0644 " src/cmd/ksh93/${_docs} " " ${pkgdir} /usr/share/doc/ksh/${_docs} "
242
- done
87
+ # Install copyright and license files
88
+ install -Dm0644 LICENSE.md " ${pkgdir} /usr/share/licenses/ksh/LICENSE.md"
89
+ install -Dm0644 COPYRIGHT " ${pkgdir} /usr/share/licenses/ksh/COPYRIGHT"
243
90
244
- # Because ksh.exe, like mksh, provided by this package and often people want to specify ksh93,
245
- # I will make a copy of of the ksh executable naming it ksh93.exe.
246
- cp " ${pkgdir} /usr/bin/ksh.exe " " ${pkgdir} /usr/bin/ksh93.exe "
247
-
248
- # Lastly, move ksh-specific /usr/share/fun to /usr/share/ksh/functions
249
- mv " ${pkgdir} /usr/share/fun " " ${pkgdir} /usr/share/ksh/functions "
91
+ local _docs
92
+ for _docs in ' builtins.mm ' ' COMPATIBILITY ' ' DESIGN ' ' OBSOLETE ' ' PROMO.mm ' \
93
+ ' README ' ' README-AUDIT.md ' ' RELEASE ' ' RELEASE88 ' ' RELEASE93 ' ' sh.memo ' \
94
+ ' TYPES ' ; do
95
+ install -Dm0644 " src/cmd/ksh93/ ${_docs} " " ${pkgdir} /usr/share/doc/ ksh/${_docs} "
96
+ done
250
97
251
- # It was requested to add as well the tests subdir
252
- for I in src/cmd/ksh93/tests/* ; do
253
- install -Dm0644 " $I " " ${pkgdir} /usr/share/ksh/tests/$( basename $I ) "
254
- done
98
+ # Because ksh.exe, like mksh, provided by this package and often people want to specify ksh93,
99
+ # I will make a copy of of the ksh executable naming it ksh93.exe.
100
+ cp " ${pkgdir} /usr/bin/ksh.exe" " ${pkgdir} /usr/bin/ksh93.exe"
255
101
256
-
102
+ # Lastly, move ksh-specific /usr/share/fun to /usr/share/ksh/functions
103
+ mv " ${pkgdir} /usr/share/fun" " ${pkgdir} /usr/share/ksh/functions"
257
104
105
+ # It was requested to add as well the tests subdir
106
+ for I in src/cmd/ksh93/tests/* ; do
107
+ install -Dm0644 " $I " " ${pkgdir} /usr/share/ksh/tests/$( basename $I ) "
108
+ done
258
109
}
0 commit comments