Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
orig
*.IMG
real-ld
objcopy
objdump
*.o
*.sw?
coffsyrup
123
ld
binutils-*
objcopy
objdump
ld
gzip-*
gzip
gunzip
zcat
drawtest
*.a
keymap/keymap
Expand Down
48 changes: 24 additions & 24 deletions binutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,55 @@ BINUTILS_DL="https://ftp.gnu.org/gnu/binutils"
BINUTILS_XZ="binutils-2.38.tar.xz"
BINUTILS_DIR="$(basename $BINUTILS_XZ .tar.xz)"
BINUTILS_URL="$BINUTILS_DL/$BINUTILS_XZ"
ORIG_DIR="$(pwd)"
ORIGIN_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"

# Dont continue on error.
set -e

# Help text.
if [ "$1" = '-h' ]; then
echo >&2 "Usage: $0 [clean]"
echo >&2
echo >&2 'Specify "clean" to remove binutils, otherwise it will be downloaded and built.'
exit 1
echo >&2 "Usage: $0 [clean]"
echo >&2
echo >&2 'Specify "clean" to remove binutils, otherwise it will be downloaded and built.'
exit 1
fi

# Optional cleanup if requested.
if [ "$1" = 'clean' ]; then
rm -fv objcopy objdump ld "$BINUTILS_XZ"
rm -rfv "$BINUTILS_DIR"
exit
rm -fv "$ORIGIN_DIR/objcopy" "$ORIGIN_DIR/objdump" "$ORIGIN_DIR/ld"
rm -rfv "$BINUTILS_DIR"
rm -fv "$ORIGIN_DIR/$BINUTILS_XZ"
exit
fi

# Download binutils.
if [ ! -f "$BINUTILS_XZ" ]; then
wget "$BINUTILS_URL"
wget "$BINUTILS_URL"
fi

# Extract binutils.
if [ ! -d "$BINUTILS_DIR" ]; then
tar xf "$BINUTILS_XZ"
xzcat "$BINUTILS_XZ" | tar xf -
fi

# Compile binutils.
if [ ! -x "$BINUTILS_DIR/binutils/objcopy" ]; then
cd "$BINUTILS_DIR"
./configure --enable-targets=i386-pc-elf32 \
--disable-gas \
--disable-libctf \
--disable-plugins \
--disable-gprof \
--enable-compressed-debug-sections=none

make all-ld -j$(nproc) MAKEINFO=true
cd "$BINUTILS_DIR" && \
./configure --enable-targets=i386-pc-elf32 \
--disable-gas \
--disable-libctf \
--disable-plugins \
--disable-gprof \
--enable-compressed-debug-sections=none && \
gmake all-ld -j$(nproc) MAKEINFO=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Command gmake is not found in default Ubuntu Linux installation even after running sudo apt install make. Can you specify the appropriate command (gmake or make) by detecting at runtime?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most certainly. Added a script to detect GNU make.

cd "$ORIGIN_DIR"
fi

# Copy compiled binaries to working directory.
copy() {
test ! -x "$2" && cp -v "$1" "$2"
test ! -x "$2" && cp -v "$1" "$2"
}

cd "$ORIG_DIR"
copy "$BINUTILS_DIR/binutils/objcopy" objcopy
copy "$BINUTILS_DIR/binutils/objdump" objdump
copy "$BINUTILS_DIR/ld/ld-new" ld
copy "$BINUTILS_DIR/binutils/objcopy" "$ORIGIN_DIR/objcopy"
copy "$BINUTILS_DIR/binutils/objdump" "$ORIGIN_DIR/objdump"
copy "$BINUTILS_DIR/ld/ld-new" "$ORIGIN_DIR/ld"
7 changes: 3 additions & 4 deletions extract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ echo '==> Reconstructing object file'

if ! cat "${LOTUS}"/sysV386/lib/123.o.z_1 "${LOTUS}"/sysV386/lib/123.o.z_2 | zcat > "${ORIG}/123.o"; then
echo >&2 'Failed to decompress object files.'

echo >&2 'If you see the message "code out of range", gzip is too old.'
echo >&2 'You can try running ./gzip.sh to build a recent gzip that is known to work.'
exit 1
Expand All @@ -63,10 +62,10 @@ echo '==> Uncompressing and copying remaining object files'
cp "${LOTUS}"/sysV386/lib/*.o "${ORIG}/"

echo '==> Copying the banner template over'
install -vDm644 "${ROOT}/usr/tmp/lotus_install/123/banner" "${LOTUS}/ri/USA-English/123ban.ri"
install -Dm 644 "${ROOT}/usr/tmp/lotus_install/123/banner" "${LOTUS}/ri/USA-English/123ban.ri"

echo '==> Copying default config file'
install -vDm644 l123set.cf "${ETC}/l123set.cf"
install -Dm 644 "l123set.cf" "${ETC}/l123set.cf"

echo '==> Copying man page'
install -vDm644 "${ROOT}/lotus/man/man1/123.1" "${ROOT}/man/man1/123.1"
install -Dm 644 "${ROOT}/lotus/man/man1/123.1" "${ROOT}/man/man1/123.1"
33 changes: 16 additions & 17 deletions gzip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,48 @@ GZIP_DL="https://ftp.gnu.org/gnu/gzip"
GZIP_XZ="gzip-1.12.tar.xz"
GZIP_DIR="$(basename $GZIP_XZ .tar.xz)"
GZIP_URL="$GZIP_DL/$GZIP_XZ"
ORIG_DIR="$(pwd)"
ORIGIN_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"

# Dont continue on error.
set -e

# Help text.
if [ "$1" = '-h' ]; then
echo >&2 "Usage: $0 [clean]"
echo >&2
echo >&2 'Specify "clean" to remove gzip, otherwise it will be downloaded and built.'
exit 1
echo >&2 "Usage: $0 [clean]"
echo >&2
echo >&2 'Specify "clean" to remove gzip, otherwise it will be downloaded and built.'
exit 1
fi

# Optional cleanup if requested.
if [ "$1" = 'clean' ]; then
rm -fv gzip gunzip zcat "$GZIP_XZ"
rm -rfv "$GZIP_DIR"
exit
rm -fv "$ORIGIN_DIR/gzip" "$ORIGIN_DIR/gunzip" "$ORIGIN_DIR/zcat"
rm -rfv "$GZIP_DIR"
rm -fv "$ORIGIN_DIR/$GZIP_XZ"
exit
fi

# Download gzip.
if [ ! -f "$GZIP_XZ" ]; then
wget "$GZIP_URL"
wget "$GZIP_URL"
fi

# Extract gzip.
if [ ! -d "$GZIP_DIR" ]; then
tar xf "$GZIP_XZ"
xzcat "$GZIP_XZ" | tar xf -
fi

# Compile gzip.
if [ ! -x "$GZIP_DIR/gzip" ]; then
cd "$GZIP_DIR"
./configure
make -j$(nproc)
cd "$GZIP_DIR" && ./configure && gmake -j$(nproc)
cd "$ORIGIN_DIR"
fi

# Copy compiled binaries to working directory.
copy() {
test ! -x "$2" && cp -v "$1" "$2"
}

cd "$ORIG_DIR"
copy "$GZIP_DIR/gzip" gzip
copy "$GZIP_DIR/gunzip" gunzip
copy "$GZIP_DIR/zcat" zcat
copy "$GZIP_DIR/gzip" "$ORIGIN_DIR/gzip"
copy "$GZIP_DIR/gunzip" "$ORIGIN_DIR/gunzip"
copy "$GZIP_DIR/zcat" "$ORIGIN_DIR/zcat"