Skip to content

Commit

Permalink
build: refactor to use autotools (still wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
d0p1s4m4 committed Nov 13, 2023
1 parent 86c2522 commit bf04473
Show file tree
Hide file tree
Showing 119 changed files with 967 additions and 186 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
key: toolchain-${{ matrix.arch }}

- name: Build toolchain ${{ matrix.arch }}
run: ARCH=${{ matrix.arch }} ./scripts/build_toolchain.sh
run: ARCH=${{ matrix.arch }} ./tools/build_toolchain.sh

- name: Build Fukuro ${{ matrix.arch }}
run: ARCH=${{ matrix.arch }} make
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,18 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
run: |
sudo apt-get update
sudo apt-get install build-essential libcmocka-dev
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Build
run: |
make test
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
27 changes: 25 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,30 @@ node_modules/
toolchain/
fukuro.iso
*~
test
*.gcda
*.gcno
docs/
docs/html
*.img

.config
.config.mk
config.h
*.old
test.exe

*.in
/aclocal.m4
*.sub
*.guess
/configure
/install-sh
Makefile
/tmp
/build
build.mk
/build-aux/ar-lib
/build-aux/compile
/build-aux/depcomp
/build-aux/install-sh
/build-aux/missing
*.cache
95 changes: 0 additions & 95 deletions Makefile

This file was deleted.

1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = lib sys srv
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

20 changes: 0 additions & 20 deletions arch/generic/stivale2.h

This file was deleted.

2 changes: 0 additions & 2 deletions arch/i686/boot.s

This file was deleted.

20 changes: 20 additions & 0 deletions build-aux/git-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

v=`git describe --abbrev=4 --match='v[0-9]*' HEAD 2>/dev/null`

if [ ! -n "$v" ]
then
v="0.0"
fi

c=`git rev-parse --short HEAD`

v="${v}-${c}"

s=`git status`
if [ -n "$s" ]
then
v="${v}-dirty"
fi

echo "$v" | tr -d '\012'
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ignore:
- "**/tests"
- "test"
1 change: 0 additions & 1 deletion commitlint.config.js

This file was deleted.

10 changes: 10 additions & 0 deletions compile_flags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-ansi
-pedantic
-pedantic-errors
-Wall
-Werror
-Wextra
-fno-builtin
-Wno-variadic-macros
-Dinline=__inline__
-Isrc/lib
97 changes: 97 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
m4_define([fukuro_VERSION],
m4_esyscmd([build-aux/git-version]))
AC_INIT([Fukuro],
m4_defn([fukuro_VERSION]),
[https://github.com/d0p1s4m4/Fukuro/issues])
AC_COPYRIGHT([Copyright (C) 2023 d0p1])

CFLAGS="-ffreestanding -nostdlib -fno-builtin"

AC_CONFIG_AUX_DIR([build-aux])

AM_INIT_AUTOMAKE([foreign subdir-objects])

dnl overide default AC_LANG_PROGRAM(C) macro
m4_ifdef([AC_LANG_PROGRAM(c)], m4_undefine[AC_LANG_PROGRAM(c)])
m4_define([AC_LANG_PROGRAM(C)],
[$1
int
_start (void)
{
$2
;
return 0;
}])

AC_CANONICAL_HOST

AS_CASE([$host_cpu],
[i?86], [
systype=i686
],
[x86_64], [systype=amd64],
[systype=$host_cpu]
)
AC_SUBST([systype])

m4_include([sys/configfrag.ac])

AS_IF([! test -d "$srcdir/sys/$systype"],
[AC_MSG_ERROR(["$host_cpu isn't supported by Fukuro"])])

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile lib/Makefile srv/Makefile sys/Makefile])

AC_LANG([C])
save_cross_compiling=$cross_compiling
cross_compiling=yes
AM_PROG_AS
cross_compiling=$save_cross_compiling
AC_PROG_CC
AC_PROG_CPP
AC_PROG_RANLIB
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_CC_C_O
AM_PROG_AR

AC_CHECK_TOOL([STRIP], [strip])
AC_CHECK_TOOL([OBJCOPY], [objcopy])
AC_CHECK_PROG([GZIP], [gzip], [gzip])
AC_CHECK_PROG([QEMU], [qemu-system-$host_cpu], [qemu-system-$host_cpu])
AC_CHECK_PROG([PYTHON3], [python3], [python3])
AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen])

AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_C_BIGENDIAN
AC_CHECK_HEADERS([stdarg.h])
AC_C_STRINGIZE

AC_CHECK_TYPE(uintptr_t)
AC_TYPE_SIZE_T

AC_CONFIG_LINKS(["sys/machine":"$srcdir/sys/$systype"])

AC_ARG_ENABLE([ncpus],
AS_HELP_STRING([--enable-ncpus=N], []),
[ncpu=$enable_ncpus]
[ncpu=1])
AC_DEFINE_UNQUOTED([NCPUS], [$ncpus], [number of CPUs])

m4_include([srv/configfrag.ac])

AC_OUTPUT
AC_MSG_RESULT([
Fukurō version: $PACKAGE_STRING
Architecture: $host_cpu
C Compiler: $CC
Asm Compiler: $CCAS
CFLAGS: $CFLAGS
CCASFLAGS: $CCASFLAG
LDFLAGS: $LDFLAGS
])
44 changes: 44 additions & 0 deletions docs/credits.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Credits

Fukurō takes inspirations and/or reuse code from the following projects:

## BRUTAL

Striking modernist shapes and bold use of modern C are the hallmarks of BRUTAL. Inspired by brutalist design BRUTAL combines the ideals of UNIX from the 1970s with modern technology and engineering.

URL: <https://github.com/brutal-org/brutal>

```
MIT License
Copyright (c) 2021-2022 The brutal operating system contributors
```

## cute-engineewing

A group of hackers who design minimalist software.

URL: <https://github.com/cute-engineewing>

```
BSD 3-Clause License
Copyright (c) 2021, cute-engineewing
Copyright (c) 2021, The µnix Contributors
```

## Minix 3

Minix (from mini-Unix) is a Unix-like operating system.

URL: <https://wiki.minix3.org>

```
BSD 3-Clause License
Copyright (c) 1987,1997,2001 Prentice Hall
```

## Albert Hofmann

The first known person to synthesize, ingest, and learn of the psychedelic effects of lysergic acid diethylamide (LSD).
26 changes: 26 additions & 0 deletions docs/layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Source layout

- `docs/` Documentation
- `make/` Makefiles helper
- `aarch64/`
- `arm/`
- `x86/`
- `32/`
- `64/`
- `src/`
- `kernel/`
- `arch/`
- `aarch64/`
- `arm/`
- `x86/`
- `32/`
- `64/`
- `lib/`
- `minic/`
- `fukuro/`
- `server/`
- `net/`
- `rtl8139/`
- `test/`
- `thirdparty/` Sources code from external source
- `tools/` Scripts used in order to build Fukurō
1 change: 0 additions & 1 deletion kernel/build.mk

This file was deleted.

Loading

0 comments on commit bf04473

Please sign in to comment.