Skip to content

Commit 81b20df

Browse files
authored
Add CI for FreeBSD and fix compiling errors. (sogou#1755)
1 parent 8586413 commit 81b20df

12 files changed

Lines changed: 49 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,23 @@ jobs:
4747
- name: make tutorial
4848
run: make tutorial
4949

50+
freebsd-cmake:
51+
name: freebsd
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v3
55+
- name: Build and test on FreeBSD
56+
uses: vmactions/freebsd-vm@v1
57+
with:
58+
usesh: true
59+
mem: 2048
60+
copyback: false
61+
prepare: |
62+
pkg update -f
63+
pkg install -y cmake gmake gcc pkgconf openssl
64+
run: |
65+
freebsd-version
66+
gmake
67+
gmake tutorial
68+
cd tutorial
69+
./parallel_wget http://github.com/

GNUmakefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CMAKE3 := $(shell if which cmake3>/dev/null ; then echo cmake3; else echo cmake;
99
.PHONY: $(ALL_TARGETS)
1010

1111
all: base
12-
make -C $(BUILD_DIR) -f Makefile
12+
$(MAKE) -C $(BUILD_DIR) -f Makefile
1313

1414
base:
1515
mkdir -p $(BUILD_DIR)
@@ -23,19 +23,19 @@ else
2323
endif
2424

2525
tutorial: all
26-
make -C tutorial
26+
$(MAKE) -C tutorial
2727

2828
check: all
29-
make -C test check
29+
$(MAKE) -C test check
3030

3131
install preinstall: base
3232
mkdir -p $(BUILD_DIR)
3333
cd $(BUILD_DIR) && $(CMAKE3) $(ROOT_DIR)
34-
make -C $(BUILD_DIR) -f Makefile $@
34+
$(MAKE) -C $(BUILD_DIR) -f Makefile $@
3535

3636
clean:
37-
-make -C test clean
38-
-make -C tutorial clean
37+
-$(MAKE) -C test clean
38+
-$(MAKE) -C tutorial clean
3939
rm -rf $(DEFAULT_BUILD_DIR)
4040
rm -rf _include
4141
rm -rf _lib

benchmark/GNUmakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ ifeq ($(DEBUG),y)
1515
else
1616
cd $(BUILD_DIR) && $(CMAKE3) $(ROOT_DIR)
1717
endif
18-
make -C $(BUILD_DIR) -f Makefile
18+
$(MAKE) -C $(BUILD_DIR) -f Makefile
1919

2020
clean:
2121
ifeq ($(MAKE_FILE), $(wildcard $(MAKE_FILE)))
22-
-make -f Makefile clean
22+
-$(MAKE) -f Makefile clean
2323
else ifeq (build, $(wildcard build))
24-
-make -C build clean
24+
-$(MAKE) -C build clean
2525
endif
2626
rm -rf build
2727

src/kernel/IOService_thread.cc

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,6 @@ int IOService::request(IOSession *session)
201201
return ret;
202202
}
203203

204-
#if _POSIX_SYNCHRONIZED_IO <= 0
205-
static inline int fdatasync(int fd)
206-
{
207-
return fsync(fd);
208-
}
209-
#endif
210-
211204
void *IOService::io_routine(void *arg)
212205
{
213206
IOSession *session = (IOSession *)arg;
@@ -223,12 +216,16 @@ void *IOService::io_routine(void *arg)
223216
case IO_CMD_PWRITE:
224217
ret = pwrite(fd, session->buf, session->count, session->offset);
225218
break;
226-
case IO_CMD_FSYNC:
227219
ret = fsync(fd);
228220
break;
229221
case IO_CMD_FDSYNC:
222+
#if _POSIX_SYNCHRONIZED_IO > 0
230223
ret = fdatasync(fd);
231224
break;
225+
#endif
226+
case IO_CMD_FSYNC:
227+
ret = fsync(fd);
228+
break;
232229
case IO_CMD_PREADV:
233230
ret = service->preadv(fd, (const struct iovec *)session->buf,
234231
session->count, session->offset);

src/manager/WFGlobal.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
Liu Kai (liukaidx@sogou-inc.com)
1919
*/
2020

21+
#include <netinet/in.h>
2122
#include <arpa/inet.h>
2223
#include <unistd.h>
2324
#include <signal.h>

src/nameservice/WFDnsResolver.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <sys/types.h>
2222
#include <sys/socket.h>
2323
#include <sys/un.h>
24+
#include <netinet/in.h>
2425
#include <arpa/inet.h>
2526
#include <errno.h>
2627
#include <netdb.h>

src/protocol/DnsMessage.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
Author: Liu Kai (liukaidx@sogou-inc.com)
1717
*/
1818

19-
#include <errno.h>
2019
#include <arpa/inet.h>
20+
#include <errno.h>
2121
#include "dns_types.h"
2222
#include "dns_parser.h"
2323
#include "DnsMessage.h"

src/protocol/dns_parser.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
Author: Liu Kai (liukaidx@sogou-inc.com)
1717
*/
1818

19+
#include <netinet/in.h>
20+
#include <arpa/inet.h>
1921
#include <string.h>
2022
#include <stdlib.h>
2123
#include <stdint.h>
22-
#include <arpa/inet.h>
2324
#include "dns_types.h"
2425
#include "dns_parser.h"
2526

test/GNUmakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ ifeq ($(DEBUG),y)
1515
else
1616
cd $(BUILD_DIR) && $(CMAKE3) $(ROOT_DIR)
1717
endif
18-
make -C $(BUILD_DIR) -f Makefile
18+
$(MAKE) -C $(BUILD_DIR) -f Makefile
1919

2020
check:
2121
mkdir -p $(BUILD_DIR)
2222
cd $(BUILD_DIR) && $(CMAKE3) $(ROOT_DIR)
23-
make -C $(BUILD_DIR) check CTEST_OUTPUT_ON_FAILURE=1
23+
$(MAKE) -C $(BUILD_DIR) check CTEST_OUTPUT_ON_FAILURE=1
2424

2525
clean:
2626
ifeq ($(MAKE_FILE), $(wildcard $(MAKE_FILE)))
27-
-make -f Makefile clean
27+
-$(MAKE) -f Makefile clean
2828
endif
2929
rm -rf $(DEFAULT_BUILD_DIR)
3030

tutorial/GNUmakefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@ CMAKE3 := $(shell if which cmake3>/dev/null ; then echo cmake3; else echo cmake;
1111
all:
1212
mkdir -p $(BUILD_DIR)
1313
rm -rf $(DEFAULT_BUILD_DIR)/CMakeCache.txt
14-
1514
ifeq ($(DEBUG),y)
1615
cd $(BUILD_DIR) && $(CMAKE3) -D CMAKE_BUILD_TYPE=Debug -D CONSUL=$(CONSUL) -D KAFKA=$(KAFKA) -D MYSQL=$(MYSQL) -D REDIS=$(REDIS) $(ROOT_DIR)
1716
else
1817
cd $(BUILD_DIR) && $(CMAKE3) -D CONSUL=$(CONSUL) -D KAFKA=$(KAFKA) -D MYSQL=$(MYSQL) -D REDIS=$(REDIS) $(ROOT_DIR)
1918
endif
20-
make -C $(BUILD_DIR) -f Makefile
19+
$(MAKE) -C $(BUILD_DIR) -f Makefile
2120

2221
clean:
2322
ifeq ($(MAKE_FILE), $(wildcard $(MAKE_FILE)))
24-
-make -f Makefile clean
23+
-$(MAKE) -f Makefile clean
2524
else ifeq ($(DEFAULT_BUILD_DIR), $(wildcard $(DEFAULT_BUILD_DIR)))
26-
-make -C $(DEFAULT_BUILD_DIR) clean
25+
-$(MAKE) -C $(DEFAULT_BUILD_DIR) clean
2726
endif
2827
rm -rf $(DEFAULT_BUILD_DIR)

0 commit comments

Comments
 (0)