commit:     f216135855afdeff7e1f106470b846e253936573
Author:     Jakov Smolic <jakov.smolic <AT> sartura <DOT> hr>
AuthorDate: Wed Jan 20 10:12:45 2021 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Wed Jan 20 10:12:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2161358

app-crypt/tpm-emulator: Port to EAPI 7 and GLEP 81

* Fix build with gcc-10
* Disable static-libs

Closes: https://github.com/gentoo/gentoo/pull/19113
Closes: https://bugs.gentoo.org/726492
Closes: https://bugs.gentoo.org/707256
Signed-off-by: Jakov Smolic <jakov.smolic <AT> sartura.hr>
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 .../files/tpm-emulator-0.7.5-fno-common.patch      | 48 ++++++++++++++++++++++
 .../files/tpm-emulator-0.7.5-static-libs.patch     | 26 ++++++++++++
 ....7.5-r2.ebuild => tpm-emulator-0.7.5-r3.ebuild} | 32 +++++++++------
 3 files changed, 93 insertions(+), 13 deletions(-)

diff --git a/app-crypt/tpm-emulator/files/tpm-emulator-0.7.5-fno-common.patch 
b/app-crypt/tpm-emulator/files/tpm-emulator-0.7.5-fno-common.patch
new file mode 100644
index 00000000000..88bfb33433c
--- /dev/null
+++ b/app-crypt/tpm-emulator/files/tpm-emulator-0.7.5-fno-common.patch
@@ -0,0 +1,48 @@
+https://bugs.gentoo.org/707256
+--- a/tpm/tpm_emulator_extern.h
++++ b/tpm/tpm_emulator_extern.h
+@@ -29,7 +29,7 @@ enum {
+   TPM_LOG_ERROR
+ };
+ 
+-void (*tpm_log)(int priority, const char *fmt, ...);
++extern void (*tpm_log)(int priority, const char *fmt, ...);
+ 
+ #if defined(_WIN32) || defined(_WIN64)
+ #define __BFILE__ ((strrchr(__FILE__, '\\') ? : __FILE__ - 1) + 1)
+@@ -44,27 +44,27 @@ void (*tpm_log)(int priority, const char *fmt, ...);
+ #define error(fmt, ...) tpm_log(TPM_LOG_ERROR, "%s:%d: Error: " fmt "\n", \
+                                 __BFILE__, __LINE__, ## __VA_ARGS__)
+ /* initialization */
+-int (*tpm_extern_init)(void);
+-void (*tpm_extern_release)(void);
++extern int (*tpm_extern_init)(void);
++extern void (*tpm_extern_release)(void);
+ 
+ /* memory allocation */
+ 
+-void* (*tpm_malloc)(size_t size);
++extern void* (*tpm_malloc)(size_t size);
+ 
+-void (*tpm_free)(/*const*/ void *ptr);
++extern void (*tpm_free)(/*const*/ void *ptr);
+ 
+ /* random numbers */
+ 
+-void (*tpm_get_extern_random_bytes)(void *buf, size_t nbytes);
++extern void (*tpm_get_extern_random_bytes)(void *buf, size_t nbytes);
+ 
+ /* usec since last call */
+ 
+-uint64_t (*tpm_get_ticks)(void);
++extern uint64_t (*tpm_get_ticks)(void);
+ 
+ /* file handling */
+ 
+-int (*tpm_write_to_storage)(uint8_t *data, size_t data_length);
+-int (*tpm_read_from_storage)(uint8_t **data, size_t *data_length);
++extern int (*tpm_write_to_storage)(uint8_t *data, size_t data_length);
++extern int (*tpm_read_from_storage)(uint8_t **data, size_t *data_length);
+ 
+ #endif /* _TPM_EMULATOR_EXTERN_H_ */
+ 

diff --git a/app-crypt/tpm-emulator/files/tpm-emulator-0.7.5-static-libs.patch 
b/app-crypt/tpm-emulator/files/tpm-emulator-0.7.5-static-libs.patch
new file mode 100644
index 00000000000..845229bd767
--- /dev/null
+++ b/app-crypt/tpm-emulator/files/tpm-emulator-0.7.5-static-libs.patch
@@ -0,0 +1,26 @@
+https://bugs.gentoo.org/726492
+--- a/tddl/CMakeLists.txt
++++ b/tddl/CMakeLists.txt
+@@ -5,21 +5,18 @@
+ 
+ set(tddl-tpm-emulator_SRCS "tddl.c" "tddl-tpm-emulator.h")
+ add_library(tddl-tpm-emulator SHARED ${tddl-tpm-emulator_SRCS})
+-add_library(tddl-tpm-emulator_static STATIC ${tddl-tpm-emulator_SRCS})
+ if(UNIX)
+   set_target_properties(tddl-tpm-emulator PROPERTIES SOVERSION "1.2"
+     VERSION 
"1.2.${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}")
+-  set_target_properties(tddl-tpm-emulator_static PROPERTIES OUTPUT_NAME 
tddl-tpm-emulator)
+ elseif(WIN32)
+   set_target_properties(tddl-tpm-emulator PROPERTIES OUTPUT_NAME ifxtpm)
+   set_target_properties(tddl-tpm-emulator PROPERTIES PREFIX "")
+ endif()
+ 
+ install(TARGETS tddl-tpm-emulator DESTINATION ${CMAKE_INSTALL_LIBDIR})
+-install(TARGETS tddl-tpm-emulator_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ install(FILES "tddl-tpm-emulator.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ 
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+ add_executable(test_tddl test_tddl.c)
+-target_link_libraries(test_tddl tddl-tpm-emulator_static)
++target_link_libraries(test_tddl tddl-tpm-emulator)
+ 

diff --git a/app-crypt/tpm-emulator/tpm-emulator-0.7.5-r2.ebuild 
b/app-crypt/tpm-emulator/tpm-emulator-0.7.5-r3.ebuild
similarity index 78%
rename from app-crypt/tpm-emulator/tpm-emulator-0.7.5-r2.ebuild
rename to app-crypt/tpm-emulator/tpm-emulator-0.7.5-r3.ebuild
index 9323c1f7edc..38a0d018270 100644
--- a/app-crypt/tpm-emulator/tpm-emulator-0.7.5-r2.ebuild
+++ b/app-crypt/tpm-emulator/tpm-emulator-0.7.5-r3.ebuild
@@ -1,30 +1,34 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=7
+
 MODULES_OPTIONAL_USE="modules"
-inherit user linux-mod cmake-utils udev
+inherit cmake linux-mod udev
 
 MY_P=${P/-/_}
 DESCRIPTION="Emulator driver for tpm"
 HOMEPAGE="https://github.com/PeterHuewe/tpm-emulator";
 SRC_URI="https://github.com/PeterHuewe/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
-LICENSE="GPL-2"
 
+LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-
 IUSE="mtm-emulator"
-RDEPEND="dev-libs/gmp:="
+
+RDEPEND="
+       acct-group/tpm
+       acct-user/tpm
+       dev-libs/gmp:="
 DEPEND="${RDEPEND}"
 
 PATCHES=(
-       "${FILESDIR}/${P}-build.patch"
+       "${FILESDIR}"/${P}-build.patch
+       "${FILESDIR}"/${P}-fno-common.patch
+       "${FILESDIR}"/${P}-static-libs.patch
 )
 
 pkg_setup() {
-       enewgroup tss
-       enewuser tss -1 -1 /var/lib/tpm tss
        if use modules; then
                CONFIG_CHECK="MODULES"
                MODULE_NAMES="tpmd_dev(extra:tpmd_dev/linux:)"
@@ -39,18 +43,20 @@ src_configure() {
                -DMTM_EMULATOR=$(usex mtm-emulator ON OFF)
                -DBUILD_DEV=OFF
        )
-       cmake-utils_src_configure
+       cmake_src_configure
 
-       use modules && ln -s "${BUILD_DIR}/config.h" tpmd_dev/linux
+       if use modules; then
+               ln -s "${BUILD_DIR}/config.h" tpmd_dev/linux || die
+       fi
 }
 
 src_compile() {
-       cmake-utils_src_compile
+       cmake_src_compile
        use modules && linux-mod_src_compile
 }
 
 src_install() {
-       cmake-utils_src_install
+       cmake_src_install
        if use modules; then
                linux-mod_src_install
                udev_newrules "tpmd_dev/linux/tpmd_dev.rules" 60-tpmd_dev.rules

Reply via email to