Commit Graph

359 Commits

Author SHA1 Message Date
Ben Wiederhake
f29fbe3c76 Meta: Fix shellcheck issues in BuildIt.sh 2020-07-29 01:24:24 +02:00
Ben Wiederhake
962e7855c5 Travis: Reduce Toolchain cache item size by 73%
Empirically, every single push or PR has to download *and then upload*
about 3.6 GiB of "cache stuff", which takes up about 400 seconds:
https://travis-ci.com/github/SerenityOS/serenity/builds/177500795
On every single push/PR! No matter what!

Those 3.6 GB consist of:
- 3.2 GB Toolchain cache (around 260 MB per compressed item)
- 0.4 GB ccache, but is capped at 0.5 GB: https://travis-ci.com/github/BenWiederhake/serenity/builds/177528549
- (And 200 KB for some weird debian package? Dunno.)

Investigating in the size, the Toolchain consists mostly of *DEBUG SYMBOLS IN
THE COMPILER BINARIES* which comically misses the point. If we ever run into
compiler crashes, any stacktrace would be lost anyway as soon as the Travis VM
shuts down. Furthermore, Travis will only ever compile Serenity itself, and
Serenity forbids C in it's Contribution Guidelines. That's another 20 MB we
don't need to cache.

Stripping the binaries and deleting the C compiler reduces the uncompressed size
from 1200 MB down to 220 MB. The compressed size gets reduced from 260 MB to 70MB.
That's a reduction of 73%.

It'll take a while until the 'old' toolchains get deleted.
I guess it'll take less than a week.

From that point onward, the Travis cache will be 1.2 GB, consisting of:
- 0.7 GB Toolchain cache
- 0.5 GB ccache
- (And that weird 200 KB deb file)

If network speeds are linear, then this should reduce the "cache network
overhead time" from about 400 seconds to about 120 seconds.

tl;dr: Strip unnecessary debug infos, delete an unused files, and speed
everything up by two minutes. (Both Toolchain cache hits and Toolchain rebuilds!)
2020-07-29 01:24:24 +02:00
Stefano Cristiano
a1e1aa96fb Toolchain: Allow building using CMake on macOS 2020-07-13 08:46:44 +02:00
Érico Nogueira Rolim
fef9ad520b
Toolchain: Use curl instead of wget (#2574)
- For Linux: curl is already listed as a dependency;
- For macOS: curl is pre-installed;
- For OpenBSD and FreeBSD: curl is a dependecy of git.
2020-06-18 16:31:12 +02:00
Paul Redmond
1a56fe714c
Toolchain: Support building the toolchain with Ninja (#2504)
This change allows users to use CMAKE_GENERATOR=Ninja ./BuildIt.sh

BuildIt.sh assumes the default cmake generator is Make. However,
the user may specify CMAKE_GENERATOR=Ninja, for example, to set the
default generator. Therefore, instead of calling make to build the
LibC target we should call cmake --build to use the correct generated
files.
2020-06-05 09:31:10 +02:00
Paul Redmond
4d4e578edf Ports: Fix CMake-based ports
The SDL port failed to build because the CMake toolchain filed pointed
to the old root. Now the toolchain file assumes that the Root is in
Build/Root.

Additionally, the AK/ and Kernel/ headers need to be installed in the
root too.
2020-05-29 20:21:10 +02:00
Yonatan Goldschmidt
00c0650f96 Build: Add Dockerfile 2020-05-22 01:19:15 +02:00
Andreas Kling
8876bfc3ac Revert "AK: Don't demangle in serenity :("
This reverts commit 4361a50225.
2020-05-20 16:24:26 +02:00
Andreas Kling
ef776c1e68 Revert "LibC: Implement Itanium C++ ABI for static variable guards"
This reverts commit cdbbe14062.
2020-05-20 16:24:26 +02:00
Andreas Kling
3d02b23af5 Revert "Toolchain: Don't pre-build LibC and LibM, nor pre-install their headers"
This reverts commit 4e051c6c15.
2020-05-20 16:24:26 +02:00
Andrew Kaster
4e051c6c15 Toolchain: Don't pre-build LibC and LibM, nor pre-install their headers
We can do away with that shenanigans now that libstdc++ is gone.
Also, simplify the toolchain dependency hash calculation to only depend
on the toolchain build script(s) and the Patches files we use to modify
the toolchain itself.
2020-05-20 08:37:50 +02:00
Andrew Kaster
cdbbe14062 LibC: Implement Itanium C++ ABI for static variable guards
This is __cxa_guard_acquire, __cxa_guard_release, and __cxa_guard_abort.

We put these symbols in a 'fake' libstdc++ to trick gcc into thinking it
has libstdc++. These symbols are necessary for C++ programs and not C
programs, so, seems file. There's no way to tell gcc that, for example,
the standard lib it should use is libc++ or libc. So, this is what we
have for now.

When threaded code enters a block that is trying to call the constructor
for a block-scope static, the compiler will emit calls to these methods
to handle the "call_once" nature of block-scope statics.

The compiler creates a 64-bit guard variable, which it checks the first
byte of to determine if the variable should be intialized or not.

If the compiler-generated code reads that byte as a 0, it will call
__cxa_guard_acquire to try and be the thread to call the constructor for
the static variable. If the first byte is 1, it will assume that the
variable's constructor was called, and go on to access it.

__cxa_guard_acquire uses one of the 7 implementation defined bytes of
the guard variable as an atomic 8 bit variable. To control a state
machine that lets each entering thread know if they gained
'initialization rights', someone is working on the varaible, someone is
working on the varaible and there's at least one thread waiting for it
to be intialized, or if the variable was initialized and it's time to
access it. We only store a 1 to the byte the compiler looks at in
__cxa_guard_release, and use a futex to handle waiting.
2020-05-20 08:37:50 +02:00
Andrew Kaster
4361a50225 AK: Don't demangle in serenity :(
In order to remove libstdc++ completely, we need to give up on their
implementation of abi::__cxa_demangle. The demangler logic will actually
have to be quite complex, and included in both the kernel and userspace.

A definite fixme for the future, to parse the mangled names into real
deal names.
2020-05-20 08:37:50 +02:00
Shannon Booth
2ffbdf5680 Toolchain/Ports: Update to gcc 10.1.0 2020-05-16 09:51:31 +02:00
Sergey Bugaev
450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00
Ben Wiederhake
29a44bc325 Travis: Fix Cache spam
Back in 36ba0a35ee I thought that Travis would
automagically delete theoldest files. Apparently it does not.

Note that no dummy changes are needed, because BuildIt.sh lists itself
as a dependency for the Toolchain. Hooray for something that works!
2020-05-11 10:27:19 +02:00
Andreas Kling
cf3b58fbe8 Services: Renamed from Servers
It didn't feel right to have a "DHCPClient" in a "Servers" directory.
Rename this to Services to better reflect the type of programs we'll
be putting in there.
2020-05-08 21:57:44 +02:00
Devashish
c4d05049c4 Toolchain: Don't create repository for patches if not necessary
The toolchain builds just fine without the git repository (tested on
windows and linux). We can skip setting up the repo and apply the
patches directly when we aren't working on the toolchain itself. A
flag `--dev` has been added for cases when git repo is needed. Without
the flag, regular patch is applied. This significantly improves build
times for first time builds.
2020-04-27 17:59:33 +02:00
Oliver Hunt
727031ac1b Toolchain: Make BuildQemu.sh choose the correct ui library when building on OSX 2020-04-07 08:44:41 +02:00
Brian Gianforcaro
de32fd0347 Toolchain: Fix trailing white space warnings when gcc.patch is applied
Noticed the warnings about trailing white space in the patch fly by as
I was running Toolchain/BuildIt.sh on a new machine.
2020-04-05 15:30:03 +02:00
Shannon Booth
c47ef61ed8 Toolchain/Ports: Update gcc to 9.3.0
Ever closer to C++20! Also fix up some of those pesky "'s
2020-03-23 08:22:41 +01:00
BenJilks
c64b5e73f5
Build: Add FreeBSD support (#1492) 2020-03-21 09:46:30 +01:00
Ben Wiederhake
36ba0a35ee Travis: Cache toolchain
This should give a significant boost to Travis speeds, because most of the
compile time is spent building the toolchain over and over again.
However, the toolchain (or libc or libm) changes only rarely,
so most rebuilds can skip this step.

The hashing has been put into a separate file to keep it
as decoupled as possible from BuiltIt.sh.
2020-03-08 14:09:08 +01:00
Jesse Buhagiar
2af5b700b0 Toolchain: Add x86_64 cross compiler build script 2020-02-27 13:00:03 +01:00
Andreas Kling
c4c1ad2289 Toolchain: Build demangling into LibC except during toolchain build 2020-02-21 18:54:57 +01:00
Emanuel Sprung
9885ccb7a7 Toolchain: Fix python build script.
This fixes #995
2020-01-25 09:09:52 +01:00
Emanuel Sprung
91b22e049b Toolchain: Fix qemu build script. 2020-01-25 09:09:52 +01:00
joshua stein
5e430e4eb4 Build: add support for building on OpenBSD
This requires gcc8 from ports to build the Toolchain.
2020-01-02 21:03:53 +01:00
Andrew Kaster
2979491512 Toolchain: Use crtbeginS and crtendS for shared objects
Turns out the reason GCC wasn't as smart about startup code for
shared objects as we hoped is because nobody told it to be :D

Change the STARTFILE_SPEC and ENDFILE_SPEC in gcc/config/serenity.h to
skip crt0.o and to link the S variants of crtbegin
and crtend for shared objects.

Because we're using the crtbegin and crtend from libgcc, also tell
libgcc in libgcc/config.host to compile crtbeginS and crtendS from
crtstuff.c.
2020-01-01 23:05:17 +01:00
Stefano Cristiano
68d721f973 Toolchain: Fix building binutils on macOS with --enable-shared 2019-12-28 21:08:04 +01:00
Andreas Kling
4a0fb34eb8 Toolchain: Allow building shared objects
Here goes a small first step towards dynamic linking.
2019-12-27 16:55:10 +01:00
Stefano Cristiano
49a789ad04 Build: Allow building serenityOS ext2 root filesystem on macOS host 2019-12-27 02:19:55 +01:00
Stefano Cristiano
9537ce918c Toolchain: Statically link serenity cross-compiler on macOS to keep the cross-toolchain self contained 2019-12-27 02:19:55 +01:00
Andreas Kling
99e0d8de2f Toolchain: Fixup CMake toolchain script to install things in /usr
Also stop clobbering the host's /usr/local/share for DATAROOTDIR.
2019-12-25 23:17:10 +01:00
joshua stein
73c953b674 Build: get rid of UseIt.sh
The build system uses relative paths to the toolchain binaries, so
modifying $PATH is no longer necessary, and nothing needs
$SERENITY_ROOT anymore.
2019-12-20 23:55:08 +01:00
Andreas Kling
097b8acf10 Toolchain: Use "make install" to install our LibC and LibM 2019-12-20 21:59:42 +01:00
Andreas Kling
cb6734c5e7 Toolchain: Redirect git command output to /dev/null
Travis is currently failing and whining about the log being too long.
It appears to be filling up with output from the git hackery.
2019-12-19 18:52:07 +01:00
Andreas Kling
0bc89df3ad Toolchain: Fix outdated MD5 sum of binutils tarball 2019-12-19 18:43:31 +01:00
Philip Herron
c73aa662bb Update toolchain to binutils-2.33.1 gcc-9.2.0
Toolchain build makes git repo out of toolchain to allow patching
Fix Makefiles to use new libstdc++
Parameterize BuildIt with default TARGET of i686 but arm is experimental
2019-12-19 18:35:03 +01:00
Emanuel Sprung
3c8a1ea386 Ports: check for native python3 installation, add build script
For python3 cross compilation, a native installation of python3 is
needed. This patch adds a build script for python3 to the toolchain
and informs the user to run that script if the python port is build
and no native python3 with the same major and minor version is
being found.
2019-11-25 11:57:18 +01:00
Emanuel Sprung
3042c942d8 Toolchain: Add QEMU build script and improve documentation
Added a script to build QEMU from source as part of the Toolchain.
The script content could be in BuildIt.sh but has been put in
a seperate file to make the build optional.

Added PATH=$PATH to sudo calls to hand over the Toolchain's PATH
setup by UseIt.sh. This enabled the script's to use the QEMU
contained in the SerenityOS toolchain.

Deleted old documentation in Meta and replaced it by a new
documentation in the Toolchain folder.
2019-11-11 21:29:56 +01:00
Nicolas Van Bossuyt
2d19072115 Toolchain: Fix indentation in BuildIt.sh (#761) 2019-11-11 20:07:43 +01:00
George Pickering
704f48d7f3 POSIX compliance: (most) shell scripts converted to generic shell
Ports/.port_include.sh, Toolchain/BuildIt.sh, Toolchain/UseIt.sh
have been left largely untouched due to use of Bash-exclusive
functions and variables such as $BASH_SOURCE, pushd and popd.
2019-11-03 09:26:22 +01:00
Larkin Nickle
f28fa616eb Toolchain/BuildIt.sh: Use curl instead of wget
We already use curl for ports, so let's be consistent.
2019-09-26 20:52:13 +02:00
Andreas Kling
c1ed16c8e8 Toolchain: Oops, we can't rely on "install.sh" to build LibC/LibM.
When we used "make install" in the past, the "install" target would pull
in the library targets as dependencies, and everything got built that way.
Now that we use "install.sh" instead, we have to build things manually.
2019-07-22 08:48:08 +02:00
Andreas Kling
acb7710a62 Toolchain: Use "install.sh" to install LibC and LibM. 2019-07-21 21:57:22 +02:00
Andreas Kling
04b9dc2d30 Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
2019-07-04 16:16:50 +02:00
Andreas Kling
612e1c7023 Toolchain: Oops, let's unbreak UseIt.sh. 2019-05-20 02:06:41 +02:00
Robin Burchell
95893b0d53 Toolchain: Add some required options to the default CMake options. 2019-05-18 02:57:38 +02:00
Robin Burchell
5babcac289 Build: Install most headers to Root (and libcore.a/libgui.a)
This makes out-of-tree linking possible. And at the same time, add a
CMakeToolchain.txt file that can be used to build arbitrary cmake-using
applications on Serenity by pointing to the CMAKE_TOOLCHAIN_FILE when
running cmake:

    -DCMAKE_TOOLCHAIN_FILE=~/code/serenity/Toolchain/CMakeToolchain.txt
2019-05-17 21:59:48 +02:00
Robin Burchell
f9515d56e7 BuildIt: Allow specifying MAKEJOBS rather than forcing to nprocs 2019-05-15 20:16:58 +02:00
Robin Burchell
bfd94dbf54 UseIt: allow sourcing from outside the Toolchain dir 2019-05-15 20:16:58 +02:00
Robin Burchell
219f2f988e BuildIt: use set -e to fail immediately on error
This saves time if something goes wrong very early in the build process.
2019-05-15 20:16:58 +02:00
Andreas Kling
81a280da87 Toolchain: Make sure everything ends up in the right place in Root/ 2019-05-08 15:50:24 +02:00
Andreas Kling
02b69cf06a Toolchain: Build GCC with --with-newlib 2019-04-29 15:09:57 +02:00
VAN BOSSUYT Nicolas
3761bc3ed7 Toolchain: The toolchain script is now working 🎉 2019-04-29 13:12:20 +02:00
VAN BOSSUYT Nicolas
4977fd22b8 Toolchain: Useit.sh finish and added an install target for the libc's Makefile and a bit of ground work for a gcc port 2019-04-29 13:12:20 +02:00
VAN BOSSUYT Nicolas
be1100497d Toolchain: GCC and binutils are now configure correctly 2019-04-29 13:12:20 +02:00
VAN BOSSUYT Nicolas
4b05ec9549 Toolchain: Added build script (wip) 2019-04-29 13:12:20 +02:00