Skip to content

Commit eb88620

Browse files
committed
feat(website): add instructions on building quick-lint-js from source
Replicate the information from docs/BUILDING.md onto the website. A website gives us more control over formatting and navigation.
1 parent f74d448 commit eb88620

File tree

9 files changed

+696
-1
lines changed

9 files changed

+696
-1
lines changed

website/public/common-nav.ejs.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,11 @@
228228
],
229229
},
230230
{ uri: "/benchmarks/", title: "Benchmarks" },
231-
{ uri: "/contribute/", title: "Contribute" },
231+
{
232+
uri: "/contribute/",
233+
title: "Contribute",
234+
subpages: await loadContributeSubpagesIfNeededAsync(),
235+
},
232236
{
233237
uri: "/blog/",
234238
title: "Blog",
@@ -273,6 +277,15 @@
273277
}
274278
}
275279

280+
async function loadContributeSubpagesIfNeededAsync() {
281+
if (currentURI.startsWith("/contribute/")) {
282+
let { loadNavSubpagesAsync } = await importFileAsync("./contribute/index.mjs");
283+
return await loadNavSubpagesAsync();
284+
} else {
285+
return [];
286+
}
287+
}
288+
276289
function isOnPageOrSubpage(page) {
277290
return page.uri === currentURI || page.subpages.some(subpage => isOnSubpage(subpage));
278291
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<!---{
2+
"title": "Building quick-lint-js from source",
3+
"navTitle": "Build"
4+
}--->
5+
6+
<!DOCTYPE html>
7+
<!-- Copyright (C) 2020 Matthew "strager" Glazar -->
8+
<!-- See end of file for extended copyright information. -->
9+
<html>
10+
<head>
11+
<%- await include("../../common-head.ejs.html") %>
12+
<link href="../../main.css" rel="stylesheet" />
13+
</head>
14+
<body class="side-bar-nav">
15+
<header><%- await include("../../common-nav.ejs.html") %></header>
16+
17+
<main>
18+
<h2><%= meta.title %></h2>
19+
20+
<h3>For contributors</h3>
21+
22+
<p>quick-lint-js contributors should use the CMake meta build system.</p>
23+
24+
<p>Recommended process:</p>
25+
26+
<ol>
27+
<li>Run CMake to create a build directory containing project files.</li>
28+
<li>Run your build tool to compile quick-lint-js and its tests.</li>
29+
<li>Run quick-lint-js' tests directly.</li>
30+
</ol>
31+
32+
<p>
33+
The exact commands you need to run differs depending on your preferred
34+
development environment and build tool:
35+
</p>
36+
37+
<ul>
38+
<li><a href="linux/">Linux</a></li>
39+
<li><a href="macos/">macOS</a></li>
40+
<li><a href="windows/">Windows</a></li>
41+
<li><a href="nix/">Nix</a></li>
42+
</ul>
43+
44+
<section id="single-command-build">
45+
<h3>Single-command build (not recommended)</h3>
46+
47+
<p>
48+
If you want to quickly compile quick-lint-js to try it out, and don't
49+
want to install CMake or Ninja, run the following commands (macOS and
50+
Linux only):
51+
</p>
52+
<blockquote>
53+
<pre><code class="shell-session"><span class="long-shell-command-line"><kbd>c++ -o quick-lint-js -std=gnu++17 -I src -I vendor/boost -I vendor/simdjson/include -I vendor/simdjson/src -D_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT=1 -D_LIBCPP_INLINE_VISIBILITY="__attribute__((internal_linkage))" src/quick-lint-js/*.cpp src/quick-lint-js/*/*.cpp vendor/boost/libs/container/src/*.cpp vendor/boost/libs/container/src/alloc_lib.c vendor/simdjson/src/simdjson.cpp -pthread</kbd></span>
54+
<kbd>./quick-lint-js <var>path/to/my-file.js</var></kbd></code></pre>
55+
</blockquote>
56+
</section>
57+
</main>
58+
59+
<footer><%- await include("../../common-footer-nav.ejs.html") %></footer>
60+
</body>
61+
</html>
62+
63+
<!--
64+
quick-lint-js finds bugs in JavaScript programs.
65+
Copyright (C) 2020 Matthew "strager" Glazar
66+
67+
This file is part of quick-lint-js.
68+
69+
quick-lint-js is free software: you can redistribute it and/or modify
70+
it under the terms of the GNU General Public License as published by
71+
the Free Software Foundation, either version 3 of the License, or
72+
(at your option) any later version.
73+
74+
quick-lint-js is distributed in the hope that it will be useful,
75+
but WITHOUT ANY WARRANTY; without even the implied warranty of
76+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77+
GNU General Public License for more details.
78+
79+
You should have received a copy of the GNU General Public License
80+
along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>.
81+
-->
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<!---{
2+
"title": "Building quick-lint-js on Linux from source",
3+
"navTitle": "Linux build"
4+
}--->
5+
6+
<!DOCTYPE html>
7+
<!-- Copyright (C) 2020 Matthew "strager" Glazar -->
8+
<!-- See end of file for extended copyright information. -->
9+
<html>
10+
<head>
11+
<%- await include("../../../common-head.ejs.html") %>
12+
<link href="../../../main.css" rel="stylesheet" />
13+
</head>
14+
<body class="side-bar-nav">
15+
<header><%- await include("../../../common-nav.ejs.html") %></header>
16+
17+
<main>
18+
<h2><%= meta.title %></h2>
19+
20+
<p>
21+
On Linux, you can build quick-lint-js using one of the following build
22+
systems:
23+
</p>
24+
<ul>
25+
<li><a href="#ninja">CMake &amp; Ninja</a> (recommended)</li>
26+
<li><a href="../nix/">Nix</a> (Nix users only)</li>
27+
<li>
28+
<a href="../#single-command-build">Single-command build</a> (not
29+
recommended)
30+
</li>
31+
</ul>
32+
33+
<section id="ninja">
34+
<h3>Build with CMake &amp; Ninja</h3>
35+
36+
<h4>0. Install build dependencies</h4>
37+
38+
<p>
39+
Before building quick-lint-js, install the following third-party
40+
dependencies:
41+
</p>
42+
43+
<ul>
44+
<li><a href="https://gcc.gnu.org/">GCC</a> version 8.3 or newer</li>
45+
<li><a href="https://cmake.org/">CMake</a> version 3.10 or newer</li>
46+
<li><a href="https://ninja-build.org/">Ninja</a></li>
47+
</ul>
48+
49+
<p>
50+
For <strong>Debian</strong>, <strong>Ubuntu</strong>, and
51+
<strong>Linux Mint</strong>, run the following command to install all
52+
necessary dependencies:
53+
</p>
54+
<blockquote>
55+
<pre><code class="shell-session"><kbd>sudo apt-get update &amp;&amp; sudo apt-get install cmake g++ ninja-build</kbd></code></pre>
56+
</blockquote>
57+
58+
<p>
59+
For <strong>Ubuntu 18.04 Bionic</strong>, run the following command to
60+
install all necessary dependencies:
61+
</p>
62+
<blockquote>
63+
<pre><code class="shell-session"><kbd>sudo apt-get update &amp;&amp; sudo apt-get install cmake g++-8 ninja-build</kbd></code></pre>
64+
</blockquote>
65+
66+
<p>
67+
For <strong>CentOS</strong>, run the following command to install all
68+
necessary dependencies:
69+
</p>
70+
<blockquote>
71+
<pre><code class="shell-session"><kbd>sudo dnf --enablerepo=powertools install cmake gcc-c++ ninja-build</kbd></code></pre>
72+
</blockquote>
73+
74+
<p>
75+
For <strong>Fedora</strong>, run the following command to install all
76+
necessary dependencies:
77+
</p>
78+
<blockquote>
79+
<pre><code class="shell-session"><kbd>sudo dnf install cmake gcc-c++ ninja-build</kbd></code></pre>
80+
</blockquote>
81+
82+
<p>
83+
For <strong>Arch Linux</strong>, run the following command to install
84+
all necessary dependencies:
85+
</p>
86+
<blockquote>
87+
<pre><code class="shell-session"><kbd>sudo pacman -Syy cmake gcc ninja</kbd></code></pre>
88+
</blockquote>
89+
90+
<h4>1. Configure with CMake</h4>
91+
92+
<p>
93+
Run the following command to create a directory called
94+
<code>build</code>:
95+
</p>
96+
<blockquote>
97+
<pre><code class="shell-session"><span class="long-shell-command-line"><kbd>mkdir build ; cd build ; cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Debug .. ; cd &quot;$OLDPWD&quot;</kbd></span></code></pre>
98+
</blockquote>
99+
100+
<p>For Ubuntu 18.04 Bionic, instead run the following command:</p>
101+
<blockquote>
102+
<pre><code class="shell-session"><span class="long-shell-command-line"><kbd>mkdir build ; cd build ; CC=gcc-8 CXX=g++-8 cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Debug .. ; cd &quot;$OLDPWD&quot;</kbd></span></code></pre>
103+
</blockquote>
104+
105+
<h4>2. Build</h4>
106+
107+
<p>
108+
Run the following command to build the quick-lint-js executable,
109+
quick-lint-js’ tests, and quick-lint-js’ benchmarks:
110+
</p>
111+
<blockquote>
112+
<pre><code class="shell-session"><kbd>ninja -C build</kbd></code></pre>
113+
</blockquote>
114+
115+
<p>If you only want to build the quick-lint-js executable:</p>
116+
<blockquote>
117+
<pre><code class="shell-session"><kbd>ninja -C build quick-lint-js</kbd></code></pre>
118+
</blockquote>
119+
120+
<p>If you only want to build quick-lint-js’ tests:</p>
121+
<blockquote>
122+
<pre><code class="shell-session"><kbd>ninja -C build quick-lint-js-test</kbd></code></pre>
123+
</blockquote>
124+
125+
<h4>3. Run</h4>
126+
<p>Run the following command to run quick-lint-js’ test suite:</p>
127+
<blockquote>
128+
<pre><code class="shell-session"><kbd>./build/test/quick-lint-js-test</kbd></code></pre>
129+
</blockquote>
130+
131+
<p>If you want to run the quick-lint-js program:</p>
132+
<blockquote>
133+
<pre><code class="shell-session"><kbd>./build/quick-lint-js --help</kbd></code></pre>
134+
</blockquote>
135+
</section>
136+
</main>
137+
138+
<footer><%- await include("../../../common-footer-nav.ejs.html") %></footer>
139+
</body>
140+
</html>
141+
142+
<!--
143+
quick-lint-js finds bugs in JavaScript programs.
144+
Copyright (C) 2020 Matthew "strager" Glazar
145+
146+
This file is part of quick-lint-js.
147+
148+
quick-lint-js is free software: you can redistribute it and/or modify
149+
it under the terms of the GNU General Public License as published by
150+
the Free Software Foundation, either version 3 of the License, or
151+
(at your option) any later version.
152+
153+
quick-lint-js is distributed in the hope that it will be useful,
154+
but WITHOUT ANY WARRANTY; without even the implied warranty of
155+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
156+
GNU General Public License for more details.
157+
158+
You should have received a copy of the GNU General Public License
159+
along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>.
160+
-->

0 commit comments

Comments
 (0)