summaryrefslogtreecommitdiff
path: root/public/build-bash-1.html
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-09-03 15:57:11 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-09-03 15:57:11 -0400
commit9e74a91806a5615f2f21cfff2ac0daddfbe80f90 (patch)
treef9765afcc9b0b87a81ec3daa170f39d6801f4dd0 /public/build-bash-1.html
parent5017c1e252b72c11db5564df6c0d78e163e01156 (diff)
Track the generated files on a separate branch
Diffstat (limited to 'public/build-bash-1.html')
-rw-r--r--public/build-bash-1.html57
1 files changed, 0 insertions, 57 deletions
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 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>Building Bash 1.14.7 on a modern system — Luke Shumaker</title>
- <link rel="stylesheet" href="assets/style.css">
- <link rel="alternate" type="application/atom+xml" href="./index.atom" name="web log entries"/>
-</head>
-<body>
-<header><a href="/">Luke Shumaker</a> » <a href=/blog>blog</a> » build-bash-1</header>
-<article>
-<h1 id="building-bash-1.14.7-on-a-modern-system">Building Bash 1.14.7 on a modern system</h1>
-<p>In a previous revision of my <a href="./bash-arrays.html">Bash arrays post</a>, I wrote:</p>
-<blockquote>
-<p>Bash 1.x won't compile with modern GCC, so I couldn't verify how it behaves.</p>
-</blockquote>
-<p>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 <code>stdarg</code> instead of the no-longer-implemented <code>varargs</code>. There's also a little fiddling with the pre-autoconf automatic configuration.</p>
-<h2 id="stdarg">stdarg</h2>
-<p>Converting to <code>stdarg</code> is pretty simple: For each variadic function (functions that take a variable number of arguments), follow these steps:</p>
-<ol type="1">
-<li>Replace <code>#include &lt;varargs.h&gt;</code> with <code>#include &lt;stdarg.h&gt;</code></li>
-<li>Replace <code>function_name (va_alist) va_dcl</code> with <code>function_name (char *format, ...)</code>.</li>
-<li>Removing the declaration and assignment for <code>format</code> from the function body.</li>
-<li>Replace <code>va_start (args);</code> with <code>va_start (args, format);</code> in the function bodies.</li>
-<li>Replace <code>function_name ();</code> with <code>function_name (char *, ...)</code> in header files and/or at the top of C files.</li>
-</ol>
-<p>There's one function that uses the variable name <code>control</code> instead of <code>format</code>.</p>
-<p>I've prepared <a href="./bash-1.14.7-gcc4-stdarg.patch">a patch</a> that does this.</p>
-<h2 id="configuration">Configuration</h2>
-<p>Instead of using autoconf-style tests to test for compiler and platform features, Bash 1 used the file <code>machines.h</code> that had <code>#ifdefs</code> 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.</p>
-<p>I made these two small changes to <code>machines.h</code> to get it to work correctly on my box:</p>
-<ol type="1">
-<li>Replace <code>#if defined (i386)</code> with <code>#if defined (i386) || defined (__x86_64__)</code>. The purpose of this is obvious.</li>
-<li>Add <code>#define USE_TERMCAP_EMULATION</code> to the section for Linux [sic] on i386 (<code># if !defined (done386) &amp;&amp; (defined (__linux__) || defined (linux))</code>). 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).</li>
-</ol>
-<p>Again, I've prepared <a href="./bash-1.14.7-machines-config.patch">a patch</a> that does this.</p>
-<h2 id="building">Building</h2>
-<p>With those adjustments, it should build, but with quite a few warnings. Making a couple of changes to <code>CFLAGS</code> should fix that:</p>
-<pre><code>make CFLAGS=&#39;-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&#39;</code></pre>
-<p>That's a doozy! Let's break it down:</p>
-<ul>
-<li><code>-O -g</code> The default value for CFLAGS (defined in <code>cpp-Makefile</code>)</li>
-<li><code>-Werror</code> Treat warnings as errors; force us to deal with any issues.</li>
-<li><code>-Wno-int-to-pointer-cast -Wno-pointer-to-int-cast</code> Allow casting between integers and pointers. Unfortunately, the way this version of Bash was designed requires this.</li>
-<li><code>-Wno-deprecated-declarations</code> The <code>getwd</code> function in <code>unistd.h</code> is considered deprecated (use <code>getcwd</code> instead). However, if <code>getcwd</code> is available, Bash uses it's own <code>getwd</code> wrapper around <code>getcwd</code> (implemented in <code>general.c</code>), and only uses the signature from <code>unistd.h</code>, not the actuall implementation from libc.</li>
-<li><code>-include stdio.h -include stdlib.h -include string.h</code> Several files are missing these header file includes. If not for <code>-Werror</code>, the default function signature fallbacks would work.</li>
-<li><code>-Dexp2=bash_exp2</code> Avoid a conflict between the parser's <code>exp2</code> helper function and <code>math.h</code>'s base-2 exponential function.</li>
-</ul>
-<p>Have fun, software archaeologists!</p>
-
-</article>
-<footer>
-<p>The content of this page is Copyright © 2015 <a href="mailto:lukeshu@sbcglobal.net">Luke Shumaker</a>.</p>
-<p>This page is licensed under the <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA-3.0</a> license.</p>
-</footer>
-</body>
-</html>