Skip to content

Commit 672edf2

Browse files
committed
chore(module): make swtpm compatible with x86-64-v2 CPUs
- Make swtpm, libgmp and gnutls compatible with x86-64-v2 CPUs. - libgmp contains lot of optimizations for x86 microarchitectures, use the most portable but not the most performant. - Prevent internet access in gnutls builder. Signed-off-by: Ivan Mikheykin <[email protected]>
1 parent 95f95e4 commit 672edf2

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

images/packages/gnutls/werf.inc.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ altPackages:
5151
- liboqs-devel
5252
- iproute2-devel
5353
- wget
54+
- tree
5455
packages:
5556
- libbrotli libidn2 libgcrypt libgmp
5657
- nettle zlib zstd p11-kit
@@ -94,10 +95,14 @@ shell:
9495
9596
cd /src
9697
97-
# Fake distcheck-hook that checks bootstrap is called without --skip-po
98-
mkdir -p po/.reference
98+
# GCC flags to produce more portable binaries.
99+
export CFLAGS="-march=x86-64-v2"
100+
export CXXFLAGS="-march=x86-64-v2"
99101
100-
./bootstrap --skip-po
102+
# Skip po downloads: bootstrap checks .reference directory to decide if it should download po files.
103+
mkdir -p po/.reference
104+
# Skip git clone: gnulib is already downloaded in the src-artifact image.
105+
./bootstrap --skip-po --no-git --gnulib-srcdir=/src/gnulib
101106
102107
./configure \
103108
--prefix=/usr \
@@ -123,3 +128,5 @@ shell:
123128
make -j$(nproc)
124129
125130
make DESTDIR=$OUTDIR install-strip
131+
132+
tree -hp $OUTDIR

images/packages/libgmp/werf.inc.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,18 @@ shell:
5757
5858
cd /src
5959
60+
export CFLAGS="-march=x86-64-v2"
61+
export CPPFLAGS="-march=x86-64-v2"
62+
export CXXFLAGS="-march=x86-64-v2"
63+
64+
# Notes:
65+
# - Use x86_64 cpu to produce the most portable binary but not the most performant one.
66+
# - Disable fat binary.
6067
./configure \
6168
--prefix=/usr \
6269
--libdir=/usr/lib64 \
70+
--disable-fat \
71+
--build x86_64-linux-gnu \
6372
--enable-cxx
6473
6574
make -j$(nproc)

images/packages/libvirt/werf.inc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,4 @@ shell:
266266
echo "Stripped: $execfile"
267267
fi
268268
done
269-
tree -hp $OUTDIR
269+
tree -hp $OUTDIR

images/packages/swtpm/werf.inc.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ altPackages:
3636
- libgnutls-openssl-devel
3737
- libfuse-devel
3838
- perl-podlators
39+
- tree
3940
packages:
4041
- libgmp libtpms openssl libjson-glib
4142
- libtasn1
@@ -78,6 +79,8 @@ shell:
7879
7980
cd /src
8081
82+
export CFLAGS="-march=x86-64-v2"
83+
8184
./autogen.sh \
8285
--disable-tests \
8386
--with-openssl \
@@ -98,3 +101,5 @@ shell:
98101
rm -rf $OUTDIR/usr/include
99102
rm -rf $OUTDIR/usr/share
100103
rm -rf $OUTDIR/usr/libexec/installed-tests
104+
105+
tree -hp $OUTDIR

images/virt-launcher/werf.inc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ altLibs:
7777
- msulogin
7878
- strace
7979
binaries:
80-
# Gnu utils (requared for swtpm)
80+
# GNU utils (required to run swtpm).
8181
- /usr/bin/certtool
8282
- /usr/bin/gnutls-cli
8383
- /usr/bin/ocsptool
@@ -210,7 +210,7 @@ import:
210210

211211
{{- include "importPackageImages" (list . $builderDependencies.packages "install") -}}
212212

213-
# Statically builded
213+
# Statically built.
214214
- image: {{ .ModuleNamePrefix }}packages/openssl
215215
add: /openssl
216216
to: /relocate

0 commit comments

Comments
 (0)