ソースを参照

Update build process

Wolf Clement 3 年 前
コミット
34da028ceb
5 ファイル変更37 行追加12 行削除
  1. 2 0
      .gitignore
  2. 6 0
      .gitmodules
  3. 16 5
      Makefile
  4. 12 6
      docs/index.md
  5. 1 1
      soulmate.sublime-project

+ 2 - 0
.gitignore

@@ -2,7 +2,9 @@
 *.sublime-workspace
 
 # Build artifacts
+*.a
 *.o
+/extern/
 soulmate
 
 # Server files

+ 6 - 0
.gitmodules

@@ -0,0 +1,6 @@
+[submodule "extern/BearSSL"]
+	path = extern/BearSSL
+	url = https://www.bearssl.org/git/BearSSL
+[submodule "extern/libuv"]
+	path = extern/libuv
+	url = https://github.com/libuv/libuv

+ 16 - 5
Makefile

@@ -1,8 +1,8 @@
 CC = clang
-CFLAGS = -Wall -Wextra -Werror
-LIBS = -luv
+CFLAGS = -Wall -Wextra -Werror -Iextern/BearSSL/inc -Iextern/libuv/include
 SRC = $(wildcard src/*.c)
 OBJ = $(patsubst src/%.c, obj/%.o, $(SRC))
+LIBRARIES = lib/libbearssl.a lib/libuv.a
 
 ifneq "$(findstring debug, $(MAKECMDGOALS))" ""
 CFLAGS += -g -fno-omit-frame-pointer -fsanitize=address
@@ -10,8 +10,8 @@ else
 CFLAGS += -O3
 endif
 
-soulmate: $(OBJ)
-	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
+soulmate: $(LIBRARIES) $(OBJ)
+	$(CC) -o $@ $^ $(CFLAGS) -Llib -luv -lbearssl
 
 obj/%.o: src/%.c
 	@mkdir -p obj
@@ -19,8 +19,19 @@ obj/%.o: src/%.c
 
 debug: soulmate
 
+lib/libbearssl.a:
+	mkdir -p lib
+	$(MAKE) -C extern/BearSSL
+	cp extern/BearSSL/build/libbearssl.a lib/
+
+lib/libuv.a:
+	mkdir -p lib
+	cd extern/libuv && sh autogen.sh && ./configure
+	$(MAKE) -C extern/libuv
+	cp extern/libuv/.libs/libuv.so.1.0.0 lib/libuv.a
+
 .PHONY: clean
 
 clean:
-	rm -rf obj
+	rm -rf obj lib
 	rm -f soulmate

+ 12 - 6
docs/index.md

@@ -1,26 +1,32 @@
 ## Building
 
-Currently, [libuv](https://libuv.org/) is the only dependency. The project is built with a simple makefile, so the instructions that worked on the OSs tested below should work on yours with minimal changes.
+soulmate requires the following dependencies :
 
-### Alpine Linux
+- [libuv](https://libuv.org/)
+
+- [BearSSL](https://bearssl.org/)
+
+These dependencies are bundled in the repository. Run `git submodule update --init` if you haven't already.
+
+### Alpine Linux (not tested)
 
 ```sh
 su
-apk add clang libuv-dev libzip-dev fts-dev
+apk add clang libzip-dev fts-dev
 make -j8
 ```
 
 ### Debian
 
 ```sh
-sudo apt install clang make libuv1-dev
+sudo apt install clang make automake libtool
 make -j8
 ```
 
-### RHEL/CentOS
+### RHEL/CentOS (not tested)
 
 ```sh
-sudo yum install clang libuv-devel
+sudo yum install clang
 make -j8
 ```
 

+ 1 - 1
soulmate.sublime-project

@@ -3,7 +3,7 @@
     {
       "path": ".",
       "file_exclude_patterns": ["soulmate"],
-      "folder_exclude_patterns": ["assets", "obj", "skins"]
+      "folder_exclude_patterns": ["assets", "lib", "obj", "skins"]
     }
 	],
   "settings": {