aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-06-11 08:07:03 +0000
committerFuwn <[email protected]>2024-06-11 08:07:03 +0000
commit0b5e41a060f818c8d455872062522fb96a20c261 (patch)
treefef298ca9945ea46bebff40b27a0f2d9a027fbee
parentrefactor: tighen clang-tidy (diff)
downloadmaple-0b5e41a060f818c8d455872062522fb96a20c261.tar.xz
maple-0b5e41a060f818c8d455872062522fb96a20c261.zip
build(docker): add simple build.ninja for Dockerfile
-rw-r--r--.dockerignore15
-rw-r--r--.gitignore3
-rw-r--r--Dockerfile15
-rw-r--r--build.ninja20
4 files changed, 35 insertions, 18 deletions
diff --git a/.dockerignore b/.dockerignore
index a5707a7..dbc39fc 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,13 +1,6 @@
-# Development
-*.pem
-out/
+# Ignore everything
+**
-# CMake
-cmake-build-*/
-CMakeLists.txt
+!maple
+!build.ninja
-# Ninja
-.ninja_*
-
-# IDE
-.idea/
diff --git a/.gitignore b/.gitignore
index 676d40c..9ab8dd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,6 @@
# Build Artifacts
build
+# Ninja
+.ninja_log
+
diff --git a/Dockerfile b/Dockerfile
index f712a3b..cce24e0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,16 +1,17 @@
FROM alpine:latest as environment
RUN apk update \
- && apk upgrade \
- && apk add --no-cache libstdc++
+ && apk upgrade \
+ && apk add --no-cache libstdc++
FROM environment as build_environment
RUN apk add --no-cache \
- clang \
- ninja \
- alpine-sdk \
- openssl-dev
+ clang \
+ ninja \
+ alpine-sdk \
+ openssl-dev \
+ linux-headers
FROM build_environment as builder
@@ -24,7 +25,7 @@ FROM environment
WORKDIR /maple
-COPY --from=builder /maple/out/maple ./
+COPY --from=builder /maple/build/maple ./
EXPOSE 1965
diff --git a/build.ninja b/build.ninja
new file mode 100644
index 0000000..8505e2c
--- /dev/null
+++ b/build.ninja
@@ -0,0 +1,20 @@
+cc = clang++
+cxxflags = -std=c++23 -Weverything -Wno-padded -Wno-c++98-compat -MMD -Wno-c++98-compat-pedantic
+ldflags = -lssl -lcrypto
+outdir = build
+name = maple
+srcdir = $name
+
+rule compile
+ command = $cc $cxxflags -c $in -o $out
+
+rule link
+ command = $cc $in -o $out $ldflags
+
+build $outdir/$name.o: compile $srcdir/$name.cc
+build $outdir/gemini.o: compile $srcdir/gemini.cc
+build $outdir/titan.o: compile $srcdir/titan.cc
+
+build $outdir/$name: link $outdir/$name.o $outdir/gemini.o $outdir/titan.o
+
+default $outdir/$name