forked from sborovic/dmzOS
Add the base containerized c toolchain environment
This commit is contained in:
parent
c5f8da292d
commit
2224ef7879
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
@ -20,5 +20,3 @@ Rules:
|
|||||||
* Please provide an adequate entry in the Wiki for each non-trivial code contribution.
|
* Please provide an adequate entry in the Wiki for each non-trivial code contribution.
|
||||||
|
|
||||||
For additional information, please refer to the [Wiki](https://gitea.dmz.rs/sborovic/dmzOS/wiki).
|
For additional information, please refer to the [Wiki](https://gitea.dmz.rs/sborovic/dmzOS/wiki).
|
||||||
|
|
||||||
TEST
|
|
18
TOOLCHAIN.md
Normal file
18
TOOLCHAIN.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Instruction on running utilities
|
||||||
|
|
||||||
|
## c_toolchain utility docker image
|
||||||
|
|
||||||
|
Dockerfile: `dockerfile.c_toolchain`
|
||||||
|
Run the docker-compose command to get a `bash` shell that is bound to the `dmzOS` directory:
|
||||||
|
```bash
|
||||||
|
docker-compose run --rm c_toolchain
|
||||||
|
```
|
||||||
|
|
||||||
|
Any changes in the container shell will be reflected in the local `dmzOS` directory.
|
||||||
|
|
||||||
|
The image contains `ident` abd `clang-format` as `C` code formatters. A .vimrc file is automatically part of the image, and it contains a rule to make vim run the following formatting command on buffer save:
|
||||||
|
```bash
|
||||||
|
ident -kr -ts4 %
|
||||||
|
```
|
||||||
|
|
||||||
|
This is using the Kernighan and Ritchie code styling, as well as identations with 4 spaces.
|
7
config/.vimrc
Normal file
7
config/.vimrc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
set nobackup
|
||||||
|
set nowritebackup
|
||||||
|
set noswapfile
|
||||||
|
set autoread
|
||||||
|
|
||||||
|
set number relativenumber
|
||||||
|
autocmd BufWritePost *.[ch] exec "!indent -kr -nut % && rm %~"
|
BIN
dmzOS/test/clang_test
Executable file
BIN
dmzOS/test/clang_test
Executable file
Binary file not shown.
BIN
dmzOS/test/gcc_test
Executable file
BIN
dmzOS/test/gcc_test
Executable file
Binary file not shown.
12
dmzOS/test/test.c
Normal file
12
dmzOS/test/test.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if (argc < 2) {
|
||||||
|
printf("Please provide at least one argument\n");
|
||||||
|
exit(1);
|
||||||
|
};
|
||||||
|
printf("Hello, C!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
c_toolchain:
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: dockerfile.c_toolchain
|
||||||
|
container_name: c_toolchain
|
||||||
|
tty: true
|
||||||
|
stdin_open: true
|
||||||
|
volumes:
|
||||||
|
- ./dmzOS:/dmzOS
|
6
dockerfile.c_toolchain
Normal file
6
dockerfile.c_toolchain
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM ubuntu:18.04
|
||||||
|
RUN apt-get update && apt-get install -y vim gcc indent clang clang-format gdb binutils
|
||||||
|
WORKDIR /dmzOS
|
||||||
|
#Getting prebuilt binary from llvm
|
||||||
|
COPY ./config/* /root
|
||||||
|
ENTRYPOINT [ "bash" ]
|
Loading…
Reference in New Issue
Block a user