Skip to content

Commit

Permalink
Merge pull request #44 from stikonas/perl
Browse files Browse the repository at this point in the history
Perl 5.005_03
  • Loading branch information
fosslinux committed Feb 22, 2021
2 parents b51a2ec + 9b314af commit 1f830b2
Show file tree
Hide file tree
Showing 20 changed files with 208 additions and 47 deletions.
46 changes: 25 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,14 @@ Going forward, we can now use `.tar.gz` for source code.
more complex edits, including just changes to lines. Luckily, we are able to
patch patch using sed only.

#### Part 12: patched mes-libc
#### Part 12: sha-2

#### Part 13: patched mes-libc

Since patch is available at this point, we can apply additional fixes to
mes-libc that are not included in the wip-m2 branch and recompile libc.

#### Part 13: patched tinycc
#### Part 14: patched tinycc

In Guix, tinycc is patched to force static linking. Prior to this step, we have
been forced to manually specify static linking for each tool. Now that we have
Expand All @@ -225,18 +227,18 @@ patch, we can patch tinycc to force static linking and then recompile it.
Note that we have to do this using tinycc 0.9.26, as tinycc 0.9.27 cannot
recompile itself for unknown reasons.

#### Part 14: make 3.80
#### Part 15: make 3.80

GNU `make` is now built so we have a more robust building system. `make` allows
us to do things like define rules for files rather than writing complex kaem
scripts.

#### Part 15: bzip2 1.0.8
#### Part 16: bzip2 1.0.8

`bzip2` is a compression format that compresses more than `gzip`. It is
preferred where we can use it, and makes source code sizes smaller.

#### Part 16: coreutils 5.0.0
#### Part 17: coreutils 5.0.0

GNU Coreutils is a collection of widely used utilities such as `cat`, `chmod`,
`chown`, `cp`, `install`, `ln`, `ls`, `mkdir`, `mknod`, `mv`, `rm`, `rmdir`,
Expand All @@ -245,14 +247,14 @@ GNU Coreutils is a collection of widely used utilities such as `cat`, `chmod`,
A few of the utilities cannot be easily compiled with Mes C library, so we skip
them.

#### Part 17: heirloom devtools
#### Part 18: heirloom devtools

`lex` and `yacc` from the Heirloom project. The Heirloom project is a collection
of standard UNIX utilities derived from code by Caldera and Sun. Differently
from the analogous utilities from the GNU project, they can be compiled with a
simple `Makefile`.

#### Part 18: bash 2.05b
#### Part 19: bash 2.05b

GNU `bash` is the most well known shell and the most complex piece of software
so far. However, it comes with a number of great benefits over kaem, including
Expand All @@ -262,7 +264,7 @@ Bash ships with a bison pre-generated file here which we delete. Unfortunately,
we have not bootstrapped bison but fortunately for us, heirloom yacc is able to
cope here.

#### Part 19: flex 2.5.11
#### Part 20: flex 2.5.11

`flex` is a tool for generating lexers or scanners: programs that recognize
lexical patters.
Expand All @@ -273,7 +275,7 @@ that it can be processed by lex for the Heirloom project (the required
modifications are mostly syntactical, plus a few workarounds to avoid some flex
advanced features).

#### Part 20: musl 1.1.24
#### Part 21: musl 1.1.24

`musl` is a C standard library that is lightweight, fast, simple, free, and
strives to be correct in the sense of standards-conformance and safety. `musl`
Expand All @@ -285,28 +287,28 @@ complex programs.
patches. In particular, we replace all weak symbols with strong symbols and will
patch `tcc` in the next step to ignore duplicate symbols.

#### Part 21: tcc 0.9.27 (musl)
#### Part 22: tcc 0.9.27 (musl)

We recompile `tcc` against musl. This is a two stage process. First we build
tcc-0.9.27 that itself links to Mes C library but produces binaries linked to
musl. Then we recompile newly produced tcc with itself. Interestingly,
tcc-0.9.27 linked against musl is self hosting. Finally, we rebuild musl once more
with the new `tcc`.
with the new `tcc` and rebuild `tcc against new `musl`.

#### Part 22: m4 1.4.7
#### Part 23: m4 1.4.7

`m4` is the first piece of software we need in the autotools suite, flex
2.6.4 and bison. It allows macros to be defined and files to be generated from those
macros.

#### Part 23: flex 2.6.14
#### Part 24: flex 2.6.14

We recompile unpatched GNU `flex` using older flex 2.5.11. This is again a two
stage process, first compiling flex using `scan.c` (from `scan.l`) created by
old flex, then recompile `scan.c` using the new version of flex to remove any
buggy artifacts from the old flex.

#### Part 24: bison 3.4.1
#### Part 25: bison 3.4.1

GNU `bison` is a parser generator. With `m4` and `flex` we can now bootstrap it
following https://gitlab.com/giomasce/bison-bootstrap. It's a 3 stage process:
Expand All @@ -317,27 +319,27 @@ following https://gitlab.com/giomasce/bison-bootstrap. It's a 3 stage process:

Finally we have a fully functional `bison` executable.

#### Part 25: grep 2.4
#### Part 26: grep 2.4

GNU `grep` is a pattern matching utility. Is is not immediately needed but will
be useful later for autotools.

#### Part 26: diffutils 2.7
#### Part 27: diffutils 2.7

`diffutils` is useful for comparing two files. It is not immediately needed but
is required later for autotools.

#### Part 27: coreutils 5.0
#### Part 28: coreutils 5.0

`coreutils` is rebuilt against musl. Additional utilities are built including
`comm`, `expr`, `date`, `dd`, `sort`, `uname`, and `uniq`.

#### Part 28: gawk 3.0.4
#### Part 29: gawk 3.0.4

`gawk` is the GNU implementation of `awk`, yet another pattern matching and data
extraction utility. It is also required for autotools.

#### Part 29: perl 5.000
#### Part 30: perl 5.000

Perl is a general purpose programming language that is especially suitable for
text processing. It is essential for autotools build system because automake
Expand All @@ -352,12 +354,14 @@ pre-generated Configure script.
At this first step we build `miniperl` which is `perl` without support for
loading modules.

#### Part 30: perl 5.003
#### Part 31: perl 5.003

We now use `perl` from the previous stage to recreate pre-generated files that
are shipped in perl 5.003. But for now we still need to use handwritten makefile
instead of `./Configure` script.

#### Part 31: perl 5.004_05
#### Part 32: perl 5.004_05

Yet another version of perl.

#### Part 33: perl 5.005_03
1 change: 1 addition & 0 deletions SHA256SUMS.sources
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ ecb5c6469d732bcf01d6ec1afe9e64f1668caba5bfdb103c28d7f537ba3cdb8a patch-2.5.9.ta
1ae43c8d2983404b9eec61c96e3ffa27e7b07e08215c95c015a4ab0095373ef3 perl-5.000.tar.gz
9fa29beb2fc4a3c373829fc051830796de301f32a719d0b52a400d1719bbd7b1 perl-5.003.tar.gz
1184478b298978b164a383ed5661e3a117c48ab97d6d0ab7ef614cdbe918b9eb perl5.004_05.tar.gz
93f41cd87ab8ee83391cfa39a63b076adeb7c3501d2efa31b98d0ef037122bd1 perl5.005_03.tar.gz
c6c37e888b136ccefab903c51149f4b7bd659d69d4aea21245f61053a57aa60a tar-1.12.tar.gz
404a8d72427a559c074e581bf8f7d5a73283faf249cd3faf6dc1c6faf97d07c7 sha-2-61555d.tar.gz
3 changes: 3 additions & 0 deletions rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ get_file https://github.com/Perl/perl5/archive/perl-5.003.tar.gz
# perl 5.004_05
get_file https://www.cpan.org/src/5.0/perl5.004_05.tar.gz

# perl 5.005_03
get_file https://www.cpan.org/src/5.0/perl5.005_03.tar.gz

# General cleanup
find tmp -name .git -exec rm -rf \;

Expand Down
2 changes: 1 addition & 1 deletion sysa/after.kaem.run
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ cd ${pkg}
kaem --file ${pkg}.kaem
cd ..

# Part 13: Check all up to this part as sha256sum
# Part 12a: Check all up to this part as sha256sum
sha256sum -c pre-sha.sha256sums

# Part 13: mes-libc-patched
Expand Down
1 change: 1 addition & 0 deletions sysa/coreutils-5.0/checksums/pass1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
3154f34ec9d8a30faf4ee8d6d29a91b4e03e61613030c2872f8215493a94d7b4 /after/bin/cat
eef190bbc238ffbd9de39b0a2629f815f3efd4a07848bbe9e5ddf15728a9ae6a /after/bin/chmod
3db27eaf11453f08205bf42007bc81df0d1e2a35eb0845de4a17803ee2d5ad9a /after/bin/cksum
5a869b028ce076d0a2ee06721956f38128a7d82d68be61e223a3051fbbb59e90 /after/bin/cp
1ed5730145be705af04ab2b6f498bb12f5778b553510373e2f7885c174d9f6c7 /after/bin/csplit
8289d664efad63db71cbc5a93bb2b08bfd19eb578ed3f8cf3902c602319a9b96 /after/bin/cut
5abdf478511ae3d7ea8d7c67808f8eb19d37cb9f5f2bd3e63c9fa1ccb939ccb5 /after/bin/echo
Expand Down
1 change: 1 addition & 0 deletions sysa/coreutils-5.0/checksums/pass2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ fafa676fe85f662f753bb5257ba6575086c6d4d7b8b27a952624db08e136b1ac /after/bin/bas
8b4e2b1ea346298b6534894e85cfa3ac4ee9bd1900da1d044a45c366d143dbf0 /after/bin/cat
24b11f735c4dcbd28e0defcef6208f419ebb3a7f33a5f7addb41d7df9e021bc1 /after/bin/chmod
8dd096b3a2973c4e3652e6bfffc30d2d85e8cb9b7f6cbbb2079cdb00a465589f /after/bin/cksum
6e9c29ae39dc9cc13925fe4066ab1867d0623bc704b2b1be6e242dc27b6c8ea1 /after/bin/cp
220ee0e1e19ad52403794872fd879619c25e2bf6b22d9616799250f76f8b9960 /after/bin/csplit
15eea66971190c390da91bd8537c01b689e1cf24cc96cd256607ef437f07f41d /after/bin/cut
0884b23703671535b882cffe99720d18f0f915b9323184dc20c0b7ef1af9ec4b /after/bin/echo
Expand Down
4 changes: 2 additions & 2 deletions sysa/coreutils-5.0/mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ COREUTILS = basename cat chmod cksum csplit cut echo expand factor false fmt fol

BINARIES = $(addprefix $(SRC_DIR)/, $(COREUTILS))

ALL=$(BINARIES) $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
all: $(BINARIES) $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
ALL=$(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
all: $(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum

LIB_DIR = lib
LIB_SRC = acl getdate posixtm posixver strftime getopt getopt1 hash hash-pjw addext argmatch backupfile basename canon-host closeout cycle-check diacrit dirname dup-safer error exclude exitfail filemode __fpending file-type fnmatch fopen-safer full-read full-write getline getstr gettime hard-locale human idcache isdir imaxtostr linebuffer localcharset long-options makepath mbswidth md5 memcasecmp memcoll modechange offtostr path-concat physmem quote quotearg readtokens rpmatch safe-read safe-write same save-cwd savedir settime sha stpcpy stripslash strtoimax strtoumax umaxtostr unicodeio userspec version-etc xgetcwd xgethostname xmalloc xmemcoll xnanosleep xreadlink xstrdup xstrtod xstrtol xstrtoul xstrtoimax xstrtoumax yesno strnlen getcwd sig2str mountlist regex canonicalize mkstemp memrchr euidaccess ftw dirfd obstack strverscmp strftime tsearch
Expand Down
4 changes: 2 additions & 2 deletions sysa/coreutils-5.0/mk/pass2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ COREUTILS = basename cat chmod cksum comm csplit cut date dd echo expand expr fa

BINARIES = $(addprefix $(SRC_DIR)/, $(COREUTILS))

ALL=$(BINARIES) $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
all: $(BINARIES) $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
ALL=$(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
all: $(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum

LIB_DIR = lib
LIB_SRC = acl alloca getdate posixtm posixver strftime getopt getopt1 hash hash-pjw addext argmatch backupfile basename canon-host closeout cycle-check diacrit dirname dup-safer error exclude exitfail filemode __fpending file-type fnmatch fopen-safer full-read full-write getline getstr gettime hard-locale human idcache isdir imaxtostr linebuffer localcharset long-options makepath mbswidth md5 memcasecmp memcoll modechange offtostr path-concat physmem quote quotearg readtokens rpmatch safe-read safe-write same save-cwd savedir settime sha stpcpy stripslash strtoimax strtoumax umaxtostr unicodeio userspec version-etc xgetcwd xgethostname xmalloc xmemcoll xnanosleep xreadlink xstrdup xstrtod xstrtol xstrtoul xstrtoimax xstrtoumax yesno strnlen getcwd sig2str mountlist regex canonicalize mkstemp memrchr euidaccess ftw obstack strverscmp strftime tsearch
Expand Down
2 changes: 0 additions & 2 deletions sysa/perl-5.003/files/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,4 @@

#define OSNAME "linux"

#define PRIVLIB_EXP "/after/lib/perl5/5.003"

#undef __DATE__ /* want reproducible build */
8 changes: 6 additions & 2 deletions sysa/perl-5.003/mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

# SPDX-License-Identifier: GPL-3.0-or-later

VERSION=5.003
PRIVLIB_EXP=$(PREFIX)/lib/perl5/$(VERSION)

CC = tcc
CFLAGS = -DPRIVLIB_EXP=\"$(PRIVLIB_EXP)\"

.PHONY: all

Expand All @@ -16,5 +20,5 @@ miniperl: $(MINIPERL_OBJ)

install: all
install miniperl $(PREFIX)/bin/perl
mkdir -p $(PREFIX)/lib/perl5/5.003
mv lib/* $(PREFIX)/lib/perl5/5.003/
mkdir -p "$(PRIVLIB_EXP)"
cp -r lib/* "$(PRIVLIB_EXP)"
2 changes: 0 additions & 2 deletions sysa/perl5.004_05/files/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@

#define OSNAME "linux"

#define PRIVLIB_EXP "/after/lib/perl5/5.004_05"

#undef __DATE__ /* want reproducible build */

#define Malloc_t void *
Expand Down
8 changes: 6 additions & 2 deletions sysa/perl5.004_05/mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

# SPDX-License-Identifier: GPL-3.0-or-later

VERSION=5.004_05
PRIVLIB_EXP=$(PREFIX)/lib/perl5/$(VERSION)

CC = tcc
CFLAGS = -DPRIVLIB_EXP=\"$(PRIVLIB_EXP)\"

.PHONY: all

Expand All @@ -16,5 +20,5 @@ miniperl: $(MINIPERL_OBJ)

install: all
install miniperl $(PREFIX)/bin/perl
mkdir -p $(PREFIX)/lib/perl5/5.004_05
mv lib/* $(PREFIX)/lib/perl5/5.004_05/
mkdir -p "$(PRIVLIB_EXP)"
cp -r lib/* "$(PRIVLIB_EXP)"
9 changes: 3 additions & 6 deletions sysa/perl5.004_05/perl5.004_05.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ src_prepare() {
mv perly.tab.c perly.c
mv perly.tab.h perly.h

# tcc messes up floats, which breaks version detection
sed -i '/require/d' embed.pl

# Regenerate other prebuilt header files
for file in embed keywords opcode; do
rm ${file}.h
Expand All @@ -22,8 +19,8 @@ src_prepare() {
}

src_install() {
default_src_install

# Remove old perl
rm -rf "${PREFIX}"/lib/perl5/5.003
rm -rf "${PREFIX}"/lib/perl5/

default_src_install
}
1 change: 1 addition & 0 deletions sysa/perl5.005_03/checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9d0a972fbcd54033f425b00d8941bb620c3358b40a4b49c175e5ca5c45dba3b2 /after/bin/perl
96 changes: 96 additions & 0 deletions sysa/perl5.005_03/files/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>

// SPDX-License-Identifier: GPL-3.0-or-later

#define MEM_ALIGNBYTES 8
#define BIN "/after/bin"
#define BYTEORDER 0x4321
#define CPPSTDIN "tcc -E"
#define CPPMINUS "-"
#define HAS_ALARM
#define HAS_FORK
#define HAS_MKDIR
#define HAS_PAUSE
#define HAS_RMDIR
#define HAS_STRERROR
#define HAS_SYS_ERRLIST
#define Strerror(e) strerror(e)

#define HAS_SYSCALL
#define HAS_TIMES

#define HAS_VPRINTF
#define Gid_t gid_t

#define I_DIRENT
#define Direntry_t struct dirent

#define I_DLFCN
#define I_FCNTL
#define I_GRP
#define I_LIMITS
#define I_MATH
#define I_NETINET_IN
#define I_PWD
#define I_STDDEF
#define I_STDLIB
#define I_STRING
#define I_SYS_DIR
#define I_SYS_IOCTL
#define I_SYS_PARAM
#define I_SYS_SELECT
#define I_SYS_STAT
#define I_SYS_TIMES
#define I_TERMIOS
#define I_TIME
#define I_UNISTD
#define I_UTIME
#define I_STDARG

#define INTSIZE 4
#define Off_t off_t

#define PRIVLIB "/after/lib/perl5"

#define _(args) args

#define RANDBITS 31

#define SCRIPTDIR "/after/bin"

#define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","BUS","FPE","KILL","USR1","SEGV","USR2","PIPE","ALRM","TERM","STKFLT","CHLD","CONT","STOP","TSTP","TTIN","TTOU","URG","XCPU","XFSZ","VTALRM","PROF","WINCH", "IO", "POLL", "PWR", "SYS", "UNUSED"
#define SIG_NUM 0, 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

#define Size_t size_t

#define STDCHAR char
#define Uid_t uid_t

#define LOC_SED "/after/bin/sed"
#define ARCHLIB "/after/lib/perl5/"

#define CAT2(a,b) a##b
#define Gconvert(x,n,t,b) gcvt((x),(n),(b))

#define Time_t time_t

#define SSize_t ssize_t

#define Sigjmp_buf sigjmp_buf

#define Sigsetjmp(buf,save_mask) setjmp(buf)
#define Siglongjmp(buf,retval) longjmp(buf,retval)

#define Signal_t void

#define OSNAME "linux"

#undef __DATE__ /* want reproducible build */

#define Malloc_t void *
#define Free_t void

#define SH_PATH "/bin/sh"
#define ARCHNAME "i386-linux"
#define BIN_EXP "/after/bin"

0 comments on commit 1f830b2

Please sign in to comment.