From 9e74a91806a5615f2f21cfff2ac0daddfbe80f90 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 3 Sep 2016 15:57:11 -0400 Subject: Track the generated files on a separate branch --- public/build-bash-1.html | 57 ------------------------------------------------ 1 file changed, 57 deletions(-) delete mode 100644 public/build-bash-1.html (limited to 'public/build-bash-1.html') diff --git a/public/build-bash-1.html b/public/build-bash-1.html deleted file mode 100644 index 3c78a6d..0000000 --- a/public/build-bash-1.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Building Bash 1.14.7 on a modern system — Luke Shumaker - - - - -
Luke Shumaker » blog » build-bash-1
-
-

Building Bash 1.14.7 on a modern system

-

In a previous revision of my Bash arrays post, I wrote:

-
-

Bash 1.x won't compile with modern GCC, so I couldn't verify how it behaves.

-
-

I recall spending a little time fighting with it, but apparently I didn't try very hard: getting Bash 1.14.7 to build on a modern box is mostly just adjusting it to use stdarg instead of the no-longer-implemented varargs. There's also a little fiddling with the pre-autoconf automatic configuration.

-

stdarg

-

Converting to stdarg is pretty simple: For each variadic function (functions that take a variable number of arguments), follow these steps:

-
    -
  1. Replace #include <varargs.h> with #include <stdarg.h>
  2. -
  3. Replace function_name (va_alist) va_dcl with function_name (char *format, ...).
  4. -
  5. Removing the declaration and assignment for format from the function body.
  6. -
  7. Replace va_start (args); with va_start (args, format); in the function bodies.
  8. -
  9. Replace function_name (); with function_name (char *, ...) in header files and/or at the top of C files.
  10. -
-

There's one function that uses the variable name control instead of format.

-

I've prepared a patch that does this.

-

Configuration

-

Instead of using autoconf-style tests to test for compiler and platform features, Bash 1 used the file machines.h that had #ifdefs and a huge database of of different operating systems for different platforms. It's gross. And quite likely won't handle your modern operating system.

-

I made these two small changes to machines.h to get it to work correctly on my box:

-
    -
  1. Replace #if defined (i386) with #if defined (i386) || defined (__x86_64__). The purpose of this is obvious.
  2. -
  3. Add #define USE_TERMCAP_EMULATION to the section for Linux [sic] on i386 (# if !defined (done386) && (defined (__linux__) || defined (linux))). What this does is tell it to link against libcurses to use curses termcap emulation, instead of linking against libtermcap (which doesn't exist on modern GNU/Linux systems).
  4. -
-

Again, I've prepared a patch that does this.

-

Building

-

With those adjustments, it should build, but with quite a few warnings. Making a couple of changes to CFLAGS should fix that:

-
make CFLAGS='-O -g -Werror -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -Wno-deprecated-declarations -include stdio.h -include stdlib.h -include string.h -Dexp2=bash_exp2'
-

That's a doozy! Let's break it down:

- -

Have fun, software archaeologists!

- -
- - - -- cgit v1.2.3-2-g168b