[gnome-boxes/wip/support-windows-11] flatpak: Bundle swtpm to provide TPM device emulation




commit 9466ae14b85f5106b3c5f3242c538ed15f0be81e
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Jan 19 11:08:31 2022 +0100

    flatpak: Bundle swtpm to provide TPM device emulation
    
    A TPM device is required for Windows 11 guests.

 build-aux/flatpak/net-tools-Makefile       | 252 +++++++++++++++++++++++++++++
 build-aux/flatpak/net-tools-config.h       |  83 ++++++++++
 build-aux/flatpak/net-tools-config.make    |  44 +++++
 build-aux/flatpak/net-tools-makefile.patch |  22 +++
 build-aux/flatpak/org.gnome.Boxes.json     |  70 ++++++++
 5 files changed, 471 insertions(+)
---
diff --git a/build-aux/flatpak/net-tools-Makefile b/build-aux/flatpak/net-tools-Makefile
new file mode 100644
index 00000000..91aa9dd4
--- /dev/null
+++ b/build-aux/flatpak/net-tools-Makefile
@@ -0,0 +1,252 @@
+#
+# Makefile     Main Makefile for the net-tools Package
+#
+# NET-TOOLS    A collection of programs that form the base set of the
+#              NET-3 Networking Distribution for the LINUX operating
+#              system.
+#
+# Author:      Bernd Eckenfels <net-tools lina inka de>
+#              Copyright 1995-1996 Bernd Eckenfels, Germany
+#
+# URLs:                http://net-tools.sourceforge.net/
+#
+# Based on:    Fred N. van Kempen, <waltje uwalt nl mugnet org>
+#              Copyright 1988-1993 MicroWalt Corporation
+#
+# Modifications:
+#              Extensively modified from 01/21/94 onwards by
+#              Alan Cox <A Cox swansea ac uk>
+#              Copyright 1993-1994 Swansea University Computer Society
+#
+# Be careful!
+# This Makefile doesn't describe complete dependencies for all include files.
+# If you change include files you might need to do make clean.
+#
+
+# set the base of the Installation
+# BASEDIR = /mnt
+BASEDIR ?= $(DESTDIR)
+BINDIR ?= /bin
+SBINDIR ?= /sbin
+
+# path to the net-lib support library. Default: lib
+NET_LIB_PATH = lib
+NET_LIB_NAME = net-tools
+
+PROGS  := ifconfig netstat route nameif
+
+-include config.make
+ifeq ($(HAVE_ARP_TOOLS),1)
+PROGS  += arp rarp
+endif
+ifeq ($(HAVE_HOSTNAME_TOOLS),1)
+PROGS  += hostname
+endif
+ifeq ($(HAVE_IP_TOOLS),1)
+PROGS   += iptunnel ipmaddr
+endif
+ifeq ($(HAVE_MII),1)
+PROGS  += mii-tool
+endif
+ifeq ($(HAVE_PLIP_TOOLS),1)
+PROGS  += plipconfig
+endif
+ifeq ($(HAVE_SERIAL_TOOLS),1)
+PROGS  += slattach
+endif
+
+# Compiler and Linker Options
+CFLAGS ?= -O2 -g
+CFLAGS += -Wall
+CFLAGS += -fno-strict-aliasing # code needs a lot of work before strict aliasing is safe
+CPPFLAGS += -D_GNU_SOURCE
+# Turn on transparent support for LFS
+CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+
+ifeq ($(HAVE_AFDECnet),1)
+DNLIB = -ldnet
+endif
+
+ifeq ($(origin CC), undefined)
+CC     = gcc
+endif
+LD     = $(CC)
+PKG_CONFIG ?= pkg-config
+
+# -------- end of user definitions --------
+
+MAINTAINER = net-tools-devel lists sourceforge net
+RELEASE           = 2.10
+
+.EXPORT_ALL_VARIABLES:
+
+ifeq ("$(NET_LIB_PATH)","lib2")
+TOPDIR   = ..
+else
+TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
+endif
+
+NET_LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a
+
+ifeq ($(HAVE_SELINUX),1)
+SE_PC_CFLAGS := $(shell $(PKG_CONFIG) --cflags libselinux)
+SE_PC_LIBS := $(shell $(PKG_CONFIG) --libs libselinux || echo -lselinux)
+SELIB = $(SE_PC_LIBS)
+CPPFLAGS += $(SE_PC_CFLAGS)
+endif
+
+CPPFLAGS += -I. -I$(TOPDIR)/include -I$(NET_LIB_PATH)
+LDFLAGS  += -L$(NET_LIB_PATH)
+
+SUBDIRS        = $(NET_LIB_PATH)/
+
+NLIB   = -l$(NET_LIB_NAME)
+
+%.o:           %.c config.h version.h intl.h lib/net-features.h $<
+               $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+
+all:           config.h version.h subdirs $(PROGS)
+
+config:        cleanconfig config.h
+
+install:       all installbin installdata
+
+mostlyclean:
+               rm -f -- *.o DEADJOE config.new *~ *.orig lib/*.o
+
+clean: mostlyclean
+               rm -f -- $(PROGS)
+               @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) ; done
+               @cd po && $(MAKE) clean
+
+cleanconfig:
+               rm -f -- config.h
+
+clobber:       clean
+               rm -f -- $(PROGS) config.h version.h config.status config.make
+               @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clobber) ; done
+
+
+dist:
+               rm -rf -- net-tools-$(RELEASE)
+               git archive --prefix=net-tools-$(RELEASE)/ HEAD | tar xf -
+               $(MAKE) -C net-tools-$(RELEASE)/po $@
+               tar cf - net-tools-$(RELEASE)/ | xz > net-tools-$(RELEASE).tar.xz
+               rm -rf -- net-tools-$(RELEASE)
+
+distcheck:     dist
+               tar xf net-tools-$(RELEASE).tar.xz
+               yes "" | $(MAKE) -C net-tools-$(RELEASE) config
+               $(MAKE) -C net-tools-$(RELEASE)
+               rm -rf -- net-tools-$(RELEASE)
+               @printf "\nThe tarball is ready to go:\n%s\n" "`du -b net-tools-$(RELEASE).tar.xz`"
+
+config.h:      config.in Makefile
+               @echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo
+               @if [ config.status -nt config.in ]; \
+                       then ./configure.sh config.status; \
+                  else ./configure.sh config.in; \
+                fi
+
+
+version.h:     Makefile
+               @echo "#define RELEASE \"net-tools $(RELEASE)\"" >version.h
+
+
+$(NET_LIB):    config.h version.h intl.h libdir
+
+i18n.h:                i18ndir
+
+libdir:                version.h
+               @$(MAKE) -C $(NET_LIB_PATH)
+
+i18ndir:
+               @$(MAKE) -C po
+
+# use libdir target for lib/ to avoid parallel build issues
+subdirs:       libdir
+               @for i in $(SUBDIRS:$(NET_LIB_PATH)/=); do $(MAKE) -C $$i || exit $$? ; done
+
+ifconfig:      $(NET_LIB) ifconfig.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(NLIB) $(LDLIBS)
+
+nameif:                $(NET_LIB) nameif.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ nameif.o $(NLIB) $(LDLIBS)
+
+hostname:      hostname.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ hostname.o $(DNLIB) $(LDLIBS)
+
+route:         $(NET_LIB) route.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ route.o $(NLIB) $(LDLIBS)
+
+arp:           $(NET_LIB) arp.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ arp.o $(NLIB) $(LDLIBS)
+
+rarp:          $(NET_LIB) rarp.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rarp.o $(NLIB) $(LDLIBS)
+
+slattach:      $(NET_LIB) slattach.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ slattach.o $(NLIB) $(LDLIBS)
+
+plipconfig:    $(NET_LIB) plipconfig.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ plipconfig.o $(NLIB) $(LDLIBS)
+
+netstat:       $(NET_LIB) netstat.o statistics.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ netstat.o statistics.o $(NLIB) $(SELIB) $(LDLIBS)
+
+iptunnel:      $(NET_LIB) iptunnel.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ iptunnel.o $(NLIB) $(LDLIBS)
+
+ipmaddr:       $(NET_LIB) ipmaddr.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ipmaddr.o $(NLIB) $(LDLIBS)
+
+mii-tool:      $(NET_LIB) mii-tool.o
+               $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB) $(LDLIBS)
+
+installbin:
+       @echo
+       @echo "######################################################"
+       @echo "Notice: ifconfig and route are now installed into /bin"
+       @echo "######################################################"
+       @echo
+       install -m 0755 -d ${BASEDIR}${SBINDIR}
+       install -m 0755 -d ${BASEDIR}${BINDIR}
+       install -m 0755 ifconfig   ${BASEDIR}${BINDIR}
+       install -m 0755 nameif     ${BASEDIR}${SBINDIR}
+       install -m 0755 netstat    ${BASEDIR}${BINDIR}
+       install -m 0755 route      ${BASEDIR}${BINDIR}
+ifeq ($(HAVE_ARP_TOOLS),1)
+       install -m 0755 arp        ${BASEDIR}${SBINDIR}
+       install -m 0755 rarp       ${BASEDIR}${SBINDIR}
+endif
+ifeq ($(HAVE_HOSTNAME_TOOLS),1)
+       install -m 0755 hostname   ${BASEDIR}${BINDIR}
+       ln -fs hostname $(BASEDIR)${BINDIR}/dnsdomainname
+ifeq ($(HAVE_HOSTNAME_SYMLINKS),1)
+       ln -fs hostname $(BASEDIR)${BINDIR}/ypdomainname
+       ln -fs hostname $(BASEDIR)${BINDIR}/nisdomainname
+       ln -fs hostname $(BASEDIR)${BINDIR}/domainname
+endif
+ifeq ($(HAVE_AFDECnet),1)
+       ln -fs hostname $(BASEDIR)${BINDIR}/nodename
+endif
+endif
+ifeq ($(HAVE_IP_TOOLS),1)
+       install -m 0755 ipmaddr    $(BASEDIR)${SBINDIR}
+       install -m 0755 iptunnel   $(BASEDIR)${SBINDIR}
+endif
+ifeq ($(HAVE_MII),1)
+       install -m 0755 mii-tool   $(BASEDIR)${SBINDIR}
+endif
+ifeq ($(HAVE_PLIP_TOOLS),1)
+       install -m 0755 plipconfig $(BASEDIR)${SBINDIR}
+endif
+ifeq ($(HAVE_SERIAL_TOOLS),1)
+       install -m 0755 slattach   $(BASEDIR)${SBINDIR}
+endif
+
+installdata:
+       $(MAKE) -C install
+       $(MAKE) -C po install
+
+# End of Makefile.
diff --git a/build-aux/flatpak/net-tools-config.h b/build-aux/flatpak/net-tools-config.h
new file mode 100644
index 00000000..064686ab
--- /dev/null
+++ b/build-aux/flatpak/net-tools-config.h
@@ -0,0 +1,83 @@
+/*
+* config.h     Automatically generated configuration includefile
+*
+* NET-TOOLS    A collection of programs that form the base set of the
+*              NET-3 Networking Distribution for the LINUX operating
+*              system.
+*
+*              DO  NOT  EDIT  DIRECTLY
+*
+*/
+
+/* 
+ * 
+ * Internationalization
+ * 
+ * The net-tools package has currently been translated to French,
+ * German and Brazilian Portugese.  Other translations are, of
+ * course, welcome.  Answer `n' here if you have no support for
+ * internationalization on your system.
+ * 
+ */
+#define I18N 0
+
+/* 
+ * 
+ * Protocol Families.
+ * 
+ */
+#define HAVE_AFUNIX 1
+#define HAVE_AFINET 1
+#define HAVE_AFINET6 1
+#define HAVE_AFIPX 1
+#define HAVE_AFATALK 1
+#define HAVE_AFAX25 1
+#define HAVE_AFNETROM 1
+#define HAVE_AFROSE 1
+#define HAVE_AFX25 1
+#define HAVE_AFECONET 0
+#define HAVE_AFDECnet 0
+#define HAVE_AFASH 1
+#define HAVE_AFBLUETOOTH 0
+
+/* 
+ * 
+ * Device Hardware types.
+ * 
+ */
+#define HAVE_HWETHER 1
+#define HAVE_HWARC 1
+#define HAVE_HWSLIP 1
+#define HAVE_HWPPP 1
+#define HAVE_HWTUNNEL 1
+#define HAVE_HWSTRIP 0
+#define HAVE_HWTR 0
+#define HAVE_HWAX25 1
+#define HAVE_HWROSE 1
+#define HAVE_HWNETROM 1
+#define HAVE_HWX25 1
+#define HAVE_HWFR 1
+#define HAVE_HWSIT 1
+#define HAVE_HWFDDI 1
+#define HAVE_HWHIPPI 1
+#define HAVE_HWASH 1
+#define HAVE_HWHDLCLAPB 1
+#define HAVE_HWIRDA 1
+#define HAVE_HWEC 0
+#define HAVE_HWEUI64 1
+#define HAVE_HWIB 1
+
+/* 
+ * 
+ * Other Features.
+ * 
+ */
+#define HAVE_FW_MASQUERADE 1
+#define HAVE_ARP_TOOLS 1
+#define HAVE_HOSTNAME_TOOLS 0
+#define HAVE_HOSTNAME_SYMLINKS 0
+#define HAVE_IP_TOOLS 1
+#define HAVE_MII 1
+#define HAVE_PLIP_TOOLS 1
+#define HAVE_SERIAL_TOOLS 1
+#define HAVE_SELINUX 1
diff --git a/build-aux/flatpak/net-tools-config.make b/build-aux/flatpak/net-tools-config.make
new file mode 100644
index 00000000..871e38c5
--- /dev/null
+++ b/build-aux/flatpak/net-tools-config.make
@@ -0,0 +1,44 @@
+I18N=0
+HAVE_AFUNIX=1
+HAVE_AFINET=1
+HAVE_AFINET6=1
+HAVE_AFIPX=1
+HAVE_AFATALK=1
+HAVE_AFAX25=1
+HAVE_AFNETROM=1
+HAVE_AFROSE=1
+HAVE_AFX25=1
+# HAVE_AFECONET=0
+# HAVE_AFDECnet=0
+HAVE_AFASH=1
+HAVE_AFBLUETOOTH=0
+HAVE_HWETHER=1
+HAVE_HWARC=1
+HAVE_HWSLIP=1
+HAVE_HWPPP=1
+HAVE_HWTUNNEL=1
+# HAVE_HWSTRIP=0
+# HAVE_HWTR=0
+HAVE_HWAX25=1
+HAVE_HWROSE=1
+HAVE_HWNETROM=1
+HAVE_HWX25=1
+HAVE_HWFR=1
+HAVE_HWSIT=1
+HAVE_HWFDDI=1
+HAVE_HWHIPPI=1
+HAVE_HWASH=1
+HAVE_HWHDLCLAPB=1
+HAVE_HWIRDA=1
+# HAVE_HWEC=0
+HAVE_HWEUI64=1
+HAVE_HWIB=1
+HAVE_FW_MASQUERADE=1
+HAVE_ARP_TOOLS=1
+# HAVE_HOSTNAME_TOOLS=0
+# HAVE_HOSTNAME_SYMLINKS=0
+HAVE_IP_TOOLS=1
+HAVE_MII=1
+HAVE_PLIP_TOOLS=1
+HAVE_SERIAL_TOOLS=1
+HAVE_SELINUX=1
diff --git a/build-aux/flatpak/net-tools-makefile.patch b/build-aux/flatpak/net-tools-makefile.patch
new file mode 100644
index 00000000..2fed57f4
--- /dev/null
+++ b/build-aux/flatpak/net-tools-makefile.patch
@@ -0,0 +1,22 @@
+diff --git a/net-tools-Makefile b/Makefile
+index 91aa9dd4..c29509df 100644
+--- a/net-tools-Makefile
++++ b/Makefile
+@@ -98,7 +98,7 @@ endif
+ CPPFLAGS += -I. -I$(TOPDIR)/include -I$(NET_LIB_PATH)
+ LDFLAGS  += -L$(NET_LIB_PATH)
+ 
+-SUBDIRS       = man/ $(NET_LIB_PATH)/
++SUBDIRS       = $(NET_LIB_PATH)/
+ 
+ NLIB  = -l$(NET_LIB_NAME)
+ 
+@@ -246,7 +246,7 @@ ifeq ($(HAVE_SERIAL_TOOLS),1)
+ endif
+ 
+ installdata:
+-      $(MAKE) -C man install
++      
+       $(MAKE) -C po install
+ 
+ # End of Makefile.
diff --git a/build-aux/flatpak/org.gnome.Boxes.json b/build-aux/flatpak/org.gnome.Boxes.json
index 48741a66..ddbff2d7 100644
--- a/build-aux/flatpak/org.gnome.Boxes.json
+++ b/build-aux/flatpak/org.gnome.Boxes.json
@@ -430,6 +430,76 @@
                 }
             ]
         },
+        {
+            "name": "libtpms",
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "https://github.com/stefanberger/libtpms";,
+                    "commit": "e81d634c27"
+                }
+            ]
+        },
+        {
+            "name": "net-tools",
+            "buildsystem": "simple",
+            "build-commands": [
+                "touch config.h",
+                "make BINDIR=/app/bin SBINDIR=/app/sbin install"
+            ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "https://jztkft.dl.sourceforge.net/project/net-tools/net-tools-2.10.tar.xz";,
+                    "sha256": "b262435a5241e89bfa51c3cabd5133753952f7a7b7b93f32e08cb9d96f580d69"
+                },
+                {
+                   "type": "patch",
+                   "path": "net-tools-makefile.patch"
+                },
+                {
+                    "type": "file",
+                    "dest-filename": "config.h",
+                    "path": "net-tools-config.h"
+                },
+                {
+                    "type": "file",
+                    "dest-filename": "config.make",
+                    "path": "net-tools-config.make"
+                }
+            ]
+        },
+        {
+            "name": "expect",
+            "buildsystem": "simple",
+            "build-commands": [
+                "aclocal && autoconf",
+                "./configure --without-tcl",
+                "make install"
+            ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": 
"https://altushost-swe.dl.sourceforge.net/project/expect/Expect/5.45.4/expect5.45.4.tar.gz";,
+                    "sha256": "49a7da83b0bdd9f46d04a04deec19c7767bb9a323e40c4781f89caf760b92c34"
+                }
+            ]
+        },
+        {
+            "name": "swtpm",
+            "config-opts": [
+                "--disable-static",
+                "--with-tpm2",
+                "--with-openssl"
+            ],
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "https://github.com/stefanberger/swtpm";,
+                    "commit" : "b79fd91c4b4a74c9c5027b517c5036952c5525db"
+                }
+            ]
+        },
         {
             "name": "gnome-boxes",
             "buildsystem": "meson",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]