mirror of
https://github.com/ivabus/pantry
synced 2024-11-10 02:25:18 +03:00
+sl (bonus: +tcl+expect) (#110)
* +sl * wip * wip * set TERM in test * works on darwin but not linux... * this feels so so close * not perfect, but it'll pass * set TCLLLIBPATH for expect Co-authored-by: Jacob Heider <jacob@tea.xyz>
This commit is contained in:
parent
168df21c94
commit
b1a543cff4
34
projects/github.com/mtoyoda/sl/package.yml
Normal file
34
projects/github.com/mtoyoda/sl/package.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
distributable:
|
||||
url: https://github.com/mtoyoda/sl/archive/{{version.raw}}.tar.gz
|
||||
strip-components: 1
|
||||
|
||||
versions:
|
||||
github: mtoyoda/sl/releases/tags
|
||||
|
||||
provides:
|
||||
- bin/sl
|
||||
|
||||
dependencies:
|
||||
invisible-island.net/ncurses: 6
|
||||
|
||||
build:
|
||||
dependencies:
|
||||
tea.xyz/gx/cc: c99
|
||||
tea.xyz/gx/make: '*'
|
||||
gnu.org/patch: '*'
|
||||
script: |
|
||||
# Add -v to allow testing resultant binary
|
||||
patch -p1 < props/version.patch
|
||||
make
|
||||
mkdir "{{prefix}}"/bin
|
||||
mv sl "{{prefix}}"/bin
|
||||
env:
|
||||
CPATH: ${{ deps.invisible-island.net/ncurses.prefix }}/include/ncursesw:$CPATH
|
||||
TEA_VERSION: ${{ version }}
|
||||
|
||||
test:
|
||||
# FIXME: best tested with Expect, if possible.
|
||||
# dependencies:
|
||||
# tcl-lang.org/expect: '*'
|
||||
# script: expect -d ./script.exp
|
||||
test "$(sl -v)" = "sl version {{version}}"
|
49
projects/github.com/mtoyoda/sl/script.exp
Executable file
49
projects/github.com/mtoyoda/sl/script.exp
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env -S expect -f
|
||||
#
|
||||
# This Expect script was generated by autoexpect on Sun Jan 15 01:33:05 2023
|
||||
# Expect and autoexpect were both written by Don Libes, NIST.
|
||||
#
|
||||
# Note that autoexpect does not guarantee a working script. It
|
||||
# necessarily has to guess about certain things. Two reasons a script
|
||||
# might fail are:
|
||||
#
|
||||
# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,
|
||||
# etc.) and devices discard or ignore keystrokes that arrive "too
|
||||
# quickly" after prompts. If you find your new script hanging up at
|
||||
# one spot, try adding a short sleep just before the previous send.
|
||||
# Setting "force_conservative" to 1 (see below) makes Expect do this
|
||||
# automatically - pausing briefly before sending each character. This
|
||||
# pacifies every program I know of. The -c flag makes the script do
|
||||
# this in the first place. The -C flag allows you to define a
|
||||
# character to toggle this mode off and on.
|
||||
|
||||
set force_conservative 0 ;# set to 1 to force conservative mode even if
|
||||
;# script wasn't run conservatively originally
|
||||
if {$force_conservative} {
|
||||
set send_slow {1 .1}
|
||||
proc send {ignore arg} {
|
||||
sleep .1
|
||||
exp_send -s -- $arg
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# 2) differing output - Some programs produce different output each time
|
||||
# they run. The "date" command is an obvious example. Another is
|
||||
# ftp, if it produces throughput statistics at the end of a file
|
||||
# transfer. If this causes a problem, delete these patterns or replace
|
||||
# them with wildcards. An alternative is to use the -p flag (for
|
||||
# "prompt") which makes Expect only look for the last line of output
|
||||
# (i.e., the prompt). The -P flag allows you to define a character to
|
||||
# toggle this mode off and on.
|
||||
#
|
||||
# Read the man page for more info.
|
||||
#
|
||||
# -Don
|
||||
|
||||
|
||||
set timeout -1
|
||||
set send_slow {1 .1}
|
||||
spawn sl -c
|
||||
match_max 100000
|
||||
expect eof
|
49
projects/github.com/mtoyoda/sl/version.patch
Normal file
49
projects/github.com/mtoyoda/sl/version.patch
Normal file
|
@ -0,0 +1,49 @@
|
|||
diff --color -u a/Makefile b/Makefile
|
||||
--- a/Makefile 2014-06-16 03:27:59
|
||||
+++ b/Makefile 2023-01-15 03:32:37
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-O
|
||||
+TEA_VERSION?= "0.0.0-dev"
|
||||
|
||||
sl: sl.c sl.h
|
||||
+ sed -i.bak -e "s/#define TEA_VERSION \".*\"/#define TEA_VERSION \"$(TEA_VERSION)\"/" sl.h
|
||||
+ rm sl.h.bak
|
||||
$(CC) $(CFLAGS) -o sl sl.c -lncurses
|
||||
Common subdirectories: a/props and b/props
|
||||
diff --color -u a/sl.c b/sl.c
|
||||
--- a/sl.c 2014-06-16 03:27:59
|
||||
+++ b/sl.c 2023-01-15 03:27:18
|
||||
@@ -39,6 +39,8 @@
|
||||
#include <curses.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include "sl.h"
|
||||
|
||||
void add_smoke(int y, int x);
|
||||
@@ -73,6 +75,10 @@
|
||||
case 'F': FLY = 1; break;
|
||||
case 'l': LOGO = 1; break;
|
||||
case 'c': C51 = 1; break;
|
||||
+ case 'v':
|
||||
+ printf("sl version %s", TEA_VERSION);
|
||||
+ exit(0);
|
||||
+ break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
diff --color -u a/sl.h b/sl.h
|
||||
--- a/sl.h 2014-06-16 03:27:59
|
||||
+++ b/sl.h 2023-01-15 03:33:08
|
||||
@@ -12,6 +12,8 @@
|
||||
#define D51LENGTH 83
|
||||
#define D51PATTERNS 6
|
||||
|
||||
+#define TEA_VERSION "UNSET"
|
||||
+
|
||||
|
||||
#define D51STR1 " ==== ________ ___________ "
|
||||
#define D51STR2 " _D _| |_______/ \\__I_I_____===__|_________| "
|
72
projects/tcl-lang.org/expect/package.yml
Normal file
72
projects/tcl-lang.org/expect/package.yml
Normal file
|
@ -0,0 +1,72 @@
|
|||
distributable:
|
||||
url: https://cytranet.dl.sourceforge.net/project/expect/Expect/{{ version }}/expect{{ version }}.tar.gz
|
||||
strip-components: 1
|
||||
|
||||
versions:
|
||||
- 5.45.4
|
||||
|
||||
dependencies:
|
||||
tcl.tk/tcl: ^8
|
||||
|
||||
interprets:
|
||||
extensions: exp
|
||||
args: [expect, -f]
|
||||
|
||||
runtime:
|
||||
env:
|
||||
TCLLIBPATH: ${{prefix}}/lib
|
||||
|
||||
build:
|
||||
dependencies:
|
||||
tea.xyz/gx/cc: c99
|
||||
tea.xyz/gx/make: '*'
|
||||
gnu.org/automake: '*'
|
||||
gnu.org/autoconf: '*'
|
||||
gnu.org/patch: '*'
|
||||
script: |
|
||||
# Config scripts are from 2003
|
||||
autoreconf --force --install --verbose
|
||||
|
||||
./configure $ARGS
|
||||
make --jobs {{ hw.concurrency }}
|
||||
make install
|
||||
|
||||
cd {{prefix}}/lib
|
||||
mv expect{{version}}/* .
|
||||
rmdir expect{{version}}
|
||||
env:
|
||||
ARGS:
|
||||
- --prefix={{ prefix }}
|
||||
- --exec-prefix={{ prefix }}
|
||||
- --with-tcl={{ deps.tcl.tk/tcl.prefix }}/lib
|
||||
darwin:
|
||||
# Works around Apple Clang 12+ "bug"
|
||||
# https://core.tcl-lang.org/expect/tktview/0d5b33c00e5b4bbedb835498b0360d7115e832a0
|
||||
CFLAGS: $CFLAGS -Wno-implicit-function-declaration
|
||||
|
||||
test:
|
||||
script: test "$(echo 'Hello, World!' | timed-read 1)" = 'Hello, World!'
|
||||
|
||||
provides:
|
||||
- bin/autoexpect
|
||||
- bin/autopasswd
|
||||
- bin/cryptdir
|
||||
- bin/decryptdir
|
||||
- bin/dislocate
|
||||
- bin/expect
|
||||
- bin/ftp-rfc
|
||||
- bin/kibitz
|
||||
- bin/lpunlock
|
||||
- bin/mkpasswd
|
||||
- bin/multixterm
|
||||
- bin/passmass
|
||||
- bin/rftp
|
||||
- bin/rlogin-cwd
|
||||
- bin/timed-read
|
||||
- bin/timed-run
|
||||
- bin/tknewsbiff
|
||||
- bin/tkpasswd
|
||||
- bin/unbuffer
|
||||
- bin/weather
|
||||
- bin/xkibitz
|
||||
- bin/xpstat
|
31
projects/tcl.tk/tcl/package.yml
Normal file
31
projects/tcl.tk/tcl/package.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
distributable:
|
||||
url: https://prdownloads.sourceforge.net/tcl/tcl{{ version }}-src.tar.gz
|
||||
strip-components: 1
|
||||
|
||||
versions:
|
||||
# FIXME: tcltk/tcl/tags needs serious parsing
|
||||
- 8.6.13
|
||||
|
||||
build:
|
||||
dependencies:
|
||||
tea.xyz/gx/cc: c99
|
||||
tea.xyz/gx/make: '*'
|
||||
working-directory: unix
|
||||
script: |
|
||||
./configure --prefix={{ prefix }}
|
||||
make --jobs {{ hw.concurrency }}
|
||||
make install
|
||||
make install-private-headers
|
||||
|
||||
cd {{prefix}}/bin
|
||||
ln -s tclsh{{version.major}}.{{version.minor}} tclsh
|
||||
test: make test
|
||||
|
||||
test:
|
||||
script: test "$(echo 'puts "Hello, World!";' | tclsh)" = 'Hello, World!'
|
||||
|
||||
provides:
|
||||
- bin/sqlite3_analyzer
|
||||
- bin/tclsh{{version.major}}.{{version.minor}}
|
||||
- bin/tclsh
|
||||
|
Loading…
Reference in a new issue