|
| 1 | +--- |
| 2 | +image: {{ $.ImageType }}/{{ $.ImageName }} |
| 3 | +final: false |
| 4 | +fromImage: builder/scratch |
| 5 | +import: |
| 6 | +- image: {{ $.ImageType }}/{{ $.ImageName }}-builder |
| 7 | + add: /out |
| 8 | + to: /nftables |
| 9 | + before: setup |
| 10 | + |
| 11 | +--- |
| 12 | +{{- $version := get $.Package $.ImageName }} |
| 13 | +{{- $gitRepoUrl := "nftables.git" }} |
| 14 | + |
| 15 | +{{- $name := print $.ImageName "-dependencies" -}} |
| 16 | +{{- define "$name" -}} |
| 17 | +packages: |
| 18 | +- gcc |
| 19 | +- git pkg-config trousers |
| 20 | +- automake autoconf make makeinfo libtool |
| 21 | +- flex bison asciidoc-a2x |
| 22 | +- tree |
| 23 | +{{- end -}} |
| 24 | + |
| 25 | +{{ $builderDependencies := include "$name" . | fromYaml }} |
| 26 | + |
| 27 | +image: {{ $.ImageType }}/{{ $.ImageName }}-builder |
| 28 | +final: false |
| 29 | +fromImage: builder/alt |
| 30 | +secrets: |
| 31 | +- id: SOURCE_REPO |
| 32 | + value: {{ $.SOURCE_REPO_GIT }} |
| 33 | +shell: |
| 34 | + beforeInstall: |
| 35 | + - | |
| 36 | + apt-get update && apt-get install -y \ |
| 37 | + {{ $builderDependencies.packages | join " " }} |
| 38 | +
|
| 39 | + # libtpms libtpms-devel requares version 0.10 that in sisyphus repo |
| 40 | + cat >/etc/apt/sources.list.d/alt-sisyphus.list<<EOF |
| 41 | + rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus x86_64 classic |
| 42 | + rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus noarch classic |
| 43 | + EOF |
| 44 | + apt-get update |
| 45 | + apt-get install -y libmnl-devel libnftnl-devel libgmp-devel libreadline-devel libjansson-devel libedit-devel |
| 46 | + rm -f /etc/apt/sources.list.d/alt-sisyphus.list |
| 47 | +
|
| 48 | + apt-get update |
| 49 | + apt-get clean |
| 50 | + rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin |
| 51 | +
|
| 52 | + install: |
| 53 | + - | |
| 54 | + OUTDIR=/out |
| 55 | + mkdir -p ~/.ssh && echo "StrictHostKeyChecking accept-new" > ~/.ssh/config |
| 56 | +
|
| 57 | + git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v{{ $version }} /src |
| 58 | + cd /src |
| 59 | +
|
| 60 | + ./autogen.sh |
| 61 | +
|
| 62 | + ./configure --prefix=/usr --libdir=/usr/lib64 --enable-python --with-python-bin=/usr/bin/python3 --with-json --with-cli=readline |
| 63 | +
|
| 64 | + make -j$(nproc) |
| 65 | +
|
| 66 | + make DESTDIR=$OUTDIR install |
| 67 | +
|
| 68 | + strip $OUTDIR/usr/sbin/nft |
| 69 | +
|
| 70 | + # We don't need man, test and samples files |
| 71 | + rm -rf $OUTDIR/usr/include |
| 72 | + rm -rf $OUTDIR/usr/share |
| 73 | + rm -rf $OUTDIR/usr/lib64/pkgconfig |
| 74 | +
|
| 75 | + tree $OUTDIR |
0 commit comments