forked from greenbone/openvas-scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't trust defaults, compile everything!
I hate yaml, I truely do.
- Loading branch information
1 parent
756fb6c
commit f70d3d9
Showing
6 changed files
with
120 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: "rs-build" | ||
|
||
on: [workflow_call] | ||
|
||
|
||
# This job builds the targets for x86_64 as well as aarch64. It is intented to | ||
# be included in the other jobs by calling: | ||
# ``` | ||
# jobs: | ||
# name: | ||
# uses: ./.github/workflows/build-rust.yml | ||
# ``` | ||
# | ||
# It saves the binaris: | ||
# - nasl-cli | ||
# - feed-verofier | ||
# | ||
# as rs-binaries. | ||
# | ||
jobs: | ||
build: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
# create branch of version | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
rust/target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- run: rustup update stable && rustup default stable | ||
# ignore failing install, it may already be installed | ||
- run: cargo install cross || true | ||
- run: CROSS_CONFIG=Cross.toml cross -v build --release --target aarch64-unknown-linux-gnu | ||
working-directory: rust | ||
- run: CROSS_CONFIG=Cross.toml cross build --release --target x86_64-unknown-linux-gnu | ||
working-directory: rust | ||
- name: "patch for debian stable" | ||
working-directory: rust | ||
run: | | ||
find . -type f -name "nasl-cli" | ||
patchelf --replace-needed libpcap.so.1 libpcap.so.0.8 target/aarch64-unknown-linux-gnu/release/nasl-cli | ||
patchelf --replace-needed libpcap.so.1 libpcap.so.0.8 target/x86_64-unknown-linux-gnu/release/nasl-cli | ||
patchelf --replace-needed libz.so libz.so.1 target/aarch64-unknown-linux-gnu/release/nasl-cli | ||
patchelf --replace-needed libz.so libz.so.1 target/x86_64-unknown-linux-gnu/release/nasl-cli | ||
- run: mkdir assets/ | ||
- run: mv rust/target/aarch64-unknown-linux-gnu/release/nasl-cli assets/nasl-cli-aarch64-unknown-linux-gnu | ||
- run: mv rust/target/x86_64-unknown-linux-gnu/release/nasl-cli assets/nasl-cli-x86_64-unknown-linux-gnu | ||
- run: mv rust/target/aarch64-unknown-linux-gnu/release/feed-verifier assets/feed-verifier-aarch64-unknown-linux-gnu | ||
- run: mv rust/target/x86_64-unknown-linux-gnu/release/feed-verifier assets/feed-verifier-x86_64-unknown-linux-gnu | ||
- name: archive | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: rs-binaries | ||
path: assets/* | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,40 @@ | ||
ARG CROSS_BASE_IMAGE | ||
FROM $CROSS_BASE_IMAGE | ||
RUN apt-get update && apt-get install -y \ | ||
libpcap-dev libssh-dev zlib1g-dev | ||
bison \ | ||
flex \ | ||
curl \ | ||
zlib1g-dev | ||
RUN curl -o /tmp/pcap.tar.gz https://www.tcpdump.org/release/libpcap-1.10.3.tar.gz | ||
WORKDIR /tmp | ||
RUN tar xvf pcap.tar.gz | ||
RUN ls -las | ||
WORKDIR /tmp/libpcap-1.10.3 | ||
ENV CC=x86_64-linux-gnu-gcc | ||
ENV CFLAGS='-Os' | ||
RUN ./configure --host=x86_64-unknown-linux-gnu --with-pcap=linux | ||
RUN cat config.log | ||
RUN make install | ||
|
||
RUN curl --output /tmp/zlib.tar.gz https://www.zlib.net/zlib-1.2.13.tar.gz | ||
WORKDIR /tmp | ||
RUN tar xvf zlib.tar.gz | ||
WORKDIR /tmp/zlib-1.2.13 | ||
ENV CC=x86_64-linux-gnu-gcc | ||
ENV CHOST=amd64 | ||
RUN ./configure | ||
RUN make install | ||
RUN ldconfig | ||
|
||
RUN curl -o /tmp/openssl.tar.gz https://www.openssl.org/source/old/1.1.1/openssl-1.1.1.tar.gz | ||
WORKDIR /tmp | ||
RUN tar xvf openssl.tar.gz | ||
RUN ls -las | ||
WORKDIR /tmp/openssl-1.1.1 | ||
ENV CC=x86_64-linux-gnu-gcc | ||
ENV CFLAGS='-Os' | ||
RUN ./Configure linux-x86_64 --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib | ||
ENV LD_LIBRARY_PATH=/usr/local/ssl/lib:${LD_LIBRARY_PATH} | ||
RUN ldconfig | ||
RUN make install | ||
ENV PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig:${PKG_CONFIG_PATH} |