-
Notifications
You must be signed in to change notification settings - Fork 10
/
portability.xml
171 lines (171 loc) · 7.97 KB
/
portability.xml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>BCHS//portability: introduction</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alegreya+Sans:400,400italic,500,700" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="highlight.css" />
<link rel="stylesheet" href="portability.css" />
<link rel="shortcut icon" type="image/png" href="/favicon-196x196.png" />
<link rel="shortcut icon" sizes="196x196" href="/favicon-196x196.png" />
<link rel="apple-touch-icon" href="/favicon-196x196.png" />
<meta property="og:title" content="BCHS//portability: introduction" />
<meta property="og:image" content="https://learnbchs.org/logo-blue.png" />
<meta property="og:url" content="https://learnbchs.org/portability.html" />
<meta property="og:type" content="website" />
<meta property="og:description" content="Portability and continuous integration for BSD.lv" />
<meta name="description" content="Portability and continuous integration for BSD.lv" />
</head>
<body>
<section itemscope="itemscope" itemtype="http://schema.org/WebPage">
<nav id="mainnav">
<div>
<span>Porting series</span>:
<span class="link"><a href="portability.html">intro</a></span>
<span class="link"><a href="portability-page2.html">config</a></span>
<span class="link"><a href="portability-page3.html">testing</a></span>
</div>
</nav>
<header id="mainhead">
<img itemprop="image" src="logo-blue.png" alt="BCHS Logo" />
<h1>
<a href="index.html" itemprop="name">BCHS</a>
</h1>
<nav>
<a href="tools.html"><span>tools</span></a>
<a href="easy.html"><span>example</span></a>
<a href="https://github.com/kristapsdz/bchs"><i class="fa fa-github"></i></a>
</nav>
</header>
<article id="article">
<header>
<p class="intro">
I recently gained access to a number of diverse systems: <a href="https://www.openbsd.org">OpenBSD</a>
on sparc64, some Linux machines (<a href="https://www.debian.org/">Debian</a>,
<a href="https://ubuntu.com/">Ubuntu</a>), <a href="https://www.netbsd.org">NetBSD</a>,
<a href="https://www.freebsd.org">FreeBSD</a>, <a href="https://omniosce.org/">OmniOS</a>,
<a href="https://www.apple.com/macos">Mac OS X</a>,
and <a href="https://www.oracle.com/solaris/solaris11/">Solaris</a>.
The mission?
Port the <a href="https://bsd.lv">BSD.lv</a> tools to all of these systems. These articles
describe the steps, tools, and methods I used along the way.
</p>
<p>
The mission of these articles isn't so much to explain the nitty-gritty of header file and
function portability—though there'll be plenty of that—but to explore the process
required if you plan on doing the same.
</p>
</header>
<section id="postheader">
<div>
<div><img src="portability-logo-freebsd.png" alt="freebsd" /></div>
<div><img src="portability-logo-netbsd.png" alt="netbsd" /></div>
<div><img src="portability-logo-omnios.svg" alt="omnios" /></div>
<div><img src="portability-logo-solaris.png" alt="solaris" /></div>
</div>
<div>
<div><img src="portability-logo-openbsd.png" alt="openbsd" /></div>
<div><img src="portability-logo-ubuntu.png" alt="ubuntu" /></div>
<div><img src="portability-logo-osx.png" alt="darwin" /></div>
<div><img src="portability-logo-debian.png" alt="debian linux" /></div>
</div>
</section>
</article>
<article>
<section id="content">
<h2>introduction</h2>
<p>
The tools (e.g.,
<a href="https://kristaps.bsd.lv/lowdown">lowdown</a>,
<a href="https://kristaps.bsd.lv/kcgi">kcgi</a>,
<a href="https://github.com/kristapsdz/openrsync">openrsync</a>, and the others listed
<a href="https://www.bsd.lv">here</a>)
are all in the C language.
All use Makefiles (<a href="https://man.openbsd.org/make.1">BSD make</a>), and all
have similar make rules.
</p>
<p>
The main development environment is <a href="https://www.openbsd.org">OpenBSD</a>.
So system features like
<a href="https://man.openbsd.org/strlcpy.3">strlcpy(3)</a>,
<a href="https://man.openbsd.org/strtonum.3">strtonum(3)</a>,
<a href="https://man.openbsd.org/arc4random.3">arc4random(3)</a>, etc. are assumed to exist.
See OpenBSD's <a href="https://www.openbsd.org/innovations.html">innovations</a> page for a list
of these features.
</p>
<p class="important">
<strong>Instead of writing for a portability library that may have its own dodgy quirks, I write
software for OpenBSD first</strong>.
So the mission is to make OpenBSD software available on non-OpenBSD systems.
In other words, the source code should run <q>natively</q> on OpenBSD, with portability glue
added in for other systems.
</p>
<p>
All tools already used <a href="https://github.com/kristapsdz/oconfigure">oconfigure</a> for
minimum portability of OpenBSD to Linux and (some) FreeBSD.
(The next section, <a href="portability-page2.html">configuration</a>, covers this system in
detail.)
</p>
<figure>
<article data-sblg-article="1"></article>
<figcaption>
Example of using
<a href="https://github.com/kristapsdz/oconfigure">oconfigure</a>
prior to this porting effort.
The flags are library locations as installed by the ports system.
Passing these to the <code>configure</code> script was the porter's job.
</figcaption>
</figure>
<p>
Source repositories were all mirrored on <a href="https://github.com">GitHub</a>.
(This is significant for testing, which I cover in <a href="portability-page3.html">part 3</a>.)
In general, mirroring on GitHub is useful because it's easy for folks to submit pull requests
and submit issues.
It's also not useful because it's easy for folks to submit pull requests and submit issues.
But that's a different story entirely.
</p>
<p>
Prior to all the documented work, portability was on an as-needed basis.
Some systems were ported to Linux (<a href="https://www.debian.org/">Debian</a>) and some to
<a href="https://www.freebsd.org">FreeBSD</a>.
The freshness of this portability was non-uniform across BSD.lv tools.
</p>
<p>
That about describes the lay of the land: C code, a simple configuration script, Makefiles, and
heavy OpenBSD dependence.
After logging in to the new systems and configuring them, I started by downloading then
expanding the configuration tools as-needed.
<a href="portability-page2.html">Read on for this work</a>!
</p>
</section>
</article>
<article>
<section>
<h2>acknowledgements</h2>
<p>
Especial thanks to <a href="https://callfortesting.org/">Michael Dexter</a> for making his
laboratory available for system portability work.
Also thanks to <a href="https://stsp.name/">Stefan Sperling</a> for making space on a SPARC64
for alignment portability.
</p>
<p>
For the system itself, I used the
<a href="https://www.openssh.com/portable.html">portable OpenSSH</a> software as both a
reference and in some cases for the compatibility functions themselves.
This tool is the gold standard for clean, readable portability!
</p>
<p>
I also used <a href="https://mandoc.bsd.lv">mandoc</a> as a basis for a lot of this work, as
Ingo's approach to the portability worked well for my needs.
</p>
</section>
</article>
</section>
<footer>
<a href="https://creativecommons.org/licenses/by/4.0/"><i class="fa fa-creative-commons"></i></a>
<a rel="author" href="https://github.com/kristapsdz">kristapsdz</a>
</footer>
</body>
</html>