@@ -4,53 +4,96 @@ stages:
4
4
- build
5
5
6
6
variables :
7
- # LIBPCAP_VERSION: "1.9.1"
7
+ LIBPCAP_VERSION : " 1.9.1"
8
+ LIBPCAP_DIR : " /libpcap"
9
+ PACKAGES : " nano bash linux-headers git flex bison wget make bluez-dev bluez"
10
+ CGO_ENABLED : 1
11
+ CGO_LDFLAGS : " -L$LIBPCAP_DIR/libpcap-$LIBPCAP_VERSION"
12
+ CGO_CFLAGS : " -O2 -I$LIBPCAP_DIR/libpcap-$LIBPCAP_VERSION"
13
+ GCC_VERSION : " 9.2.0"
14
+ MUSL_CROSS_MAKE_VERSION : " v15"
8
15
TZ : " Europe/Paris"
9
16
ARTIFACT_NAME_TEMPLATE : " $CI_JOB_NAME"
10
- # GO_IMAGE: "golang:1.15.2-buster"
11
- # PACKAGES: "software-properties-common byacc flex dpkg-dev python3 python3-pip debhelper"
12
17
BUILD_IMAGE : " golang:1.15.2-alpine"
13
- PACKAGES : " bash linux-headers build-base git flex bison"
14
-
15
-
16
- # .install-deps: &install-deps
17
- # - apt-get update
18
- # - apt-get install -y software-properties-common gcc bison flex wget make kmod build-essential
18
+
19
19
20
20
21
21
.install-deps : &install-deps
22
22
- apk update
23
23
- apk add $PACKAGES
24
24
25
+ .get-libpcap-src : &get-libpcap-src
26
+ - $CI_PROJECT_DIR/dev/image/get_libpcap_sources.sh
25
27
26
- .build-libraries : &build-libraries
27
- - cd /; git clone https://github.com/ntop/PF_RING.git
28
- - mkdir -p /usr/local/include/linux/; cp /PF_RING/kernel/linux/pf_ring.h /usr/local/include/linux/pf_ring.h
29
- - cp /go/src/netspot/extra/strdup.c /PF_RING/userland/lib
30
- - cd /PF_RING/userland/lib; ./configure;
31
- - sed -i 's/pfring_hw_filtering.o/pfring_hw_filtering.o strdup.o/' Makefile;
32
- - make; make install
33
- - cp /go/src/netspot/extra/strdup.c /PF_RING/userland/libpcap
34
- - cd /PF_RING/userland/libpcap; ./configure
35
- - sed -i 's/etherent.c/etherent.c strdup.c/' Makefile;
36
- - make; make install
28
+ # .build-libraries: &build-libraries
29
+ # - cd /; git clone https://github.com/ntop/PF_RING.git
30
+ # - mkdir -p /usr/local/include/linux/; cp /PF_RING/kernel/linux/pf_ring.h /usr/local/include/linux/pf_ring.h
31
+ # - cp /go/src/netspot/extra/strdup.c /PF_RING/userland/lib
32
+ # - cd /PF_RING/userland/lib; ./configure;
33
+ # - sed -i 's/pfring_hw_filtering.o/pfring_hw_filtering.o strdup.o/' Makefile;
34
+ # - make; make install
35
+ # - cp /go/src/netspot/extra/strdup.c /PF_RING/userland/libpcap
36
+ # - cd /PF_RING/userland/libpcap; ./configure
37
+ # - sed -i 's/etherent.c/etherent.c strdup.c/' Makefile;
38
+ # - make; make install
37
39
38
40
build_amd64 :
39
41
stage : build
40
42
image : $BUILD_IMAGE
41
43
only :
42
44
- web
45
+ variables :
46
+ TARGET_ARCH : x86_64-linux
47
+ before_script :
48
+ - ln -s /builds/netspot/netspot /go/src/netspot
49
+ - *install-deps
50
+ - *get-libpcap-src
51
+ - $CI_PROJECT_DIR/dev/image/install_toolchain.sh
52
+ script :
53
+ - $CI_PROJECT_DIR/dev/build/builder.sh $TARGET_ARCH
54
+ artifacts :
55
+ name : $ARTIFACT_NAME_TEMPLATE
56
+ paths :
57
+ - bin/netspot-$TARGET_ARCH
58
+
59
+ build_arm :
60
+ stage : build
61
+ image : $BUILD_IMAGE
62
+ only :
63
+ - web
64
+ variables :
65
+ TARGET_ARCH : arm-linux
66
+ before_script :
67
+ - ln -s /builds/netspot/netspot /go/src/netspot
68
+ - *install-deps
69
+ - *get-libpcap-src
70
+ - $CI_PROJECT_DIR/dev/image/install_toolchain.sh
71
+ script :
72
+ - $CI_PROJECT_DIR/dev/build/builder.sh $TARGET_ARCH
73
+ artifacts :
74
+ name : $ARTIFACT_NAME_TEMPLATE
75
+ paths :
76
+ - bin/netspot-$TARGET_ARCH
77
+
78
+
79
+ build_aarch64 :
80
+ stage : build
81
+ image : $BUILD_IMAGE
82
+ only :
83
+ - web
84
+ variables :
85
+ TARGET_ARCH : aarch64-linux
43
86
before_script :
44
87
- ln -s /builds/netspot/netspot /go/src/netspot
45
88
- *install-deps
46
- - *build-libraries
89
+ - *get-libpcap-src
90
+ - $CI_PROJECT_DIR/dev/image/install_toolchain.sh
47
91
script :
48
- - cd /go/src/netspot
49
- - make build_netspot_musl
92
+ - $CI_PROJECT_DIR/dev/build/builder.sh $TARGET_ARCH
50
93
artifacts :
51
94
name : $ARTIFACT_NAME_TEMPLATE
52
95
paths :
53
- - bin/netspot
96
+ - bin/netspot-$TARGET_ARCH
54
97
55
98
# build_armhf:
56
99
# stage: build
0 commit comments