-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update CMake build to define RUNPREFIX different than CMAKE_INSTALL_PREFIX for package building compatibility #980
Comments
I was able to "resolve" this challenge by updating the
|
How about this? Does this give you the control you need? index 1dfac3b601..ebf22af5ee 100644
--- a/cmake/MythOptions.cmake
+++ b/cmake/MythOptions.cmake
@@ -21,6 +21,11 @@ set(MYTH_DEFAULT_LIBS_PREFIX
CACHE PATH
"Default library install prefix if not specified on the command line."
)
+set(MYTH_RUN_PREFIX
+ ""
+ CACHE PATH
+ "The prefix where MythTV is expected to be at runtime. This may differ from MYTH_DEFAULT_PREFIX or CMAKE_INSTALL_PREFIX for packagers."
+)
# Location for downloaded tarballs.
#
diff --git a/mythtv/libs/libmythbase/CMakeLists.txt b/mythtv/libs/libmythbase/CMakeLists.txt
index c51e056175..5bde73d5b9 100644
--- a/mythtv/libs/libmythbase/CMakeLists.txt
+++ b/mythtv/libs/libmythbase/CMakeLists.txt
@@ -261,11 +261,15 @@ target_compile_definitions(mythbase PRIVATE MBASE_API)
set_source_files_properties(mythcdrom.cpp PROPERTIES COMPILE_DEFINITIONS
HAVE_LIBUDFREAD)
+if(NOT MYTH_RUN_PREFIX)
+ message(VERBOSE "Setting MYTH_RUN_PREFIX to ${CMAKE_INSTALL_PREFIX}")
+ set(MYTH_RUN_PREFIX ${CMAKE_INSTALL_PREFIX})
+endif()
set_source_files_properties(
mythdirs.cpp
PROPERTIES
COMPILE_DEFINITIONS
- "RUNPREFIX=\"${CMAKE_INSTALL_PREFIX}\";LIBDIRNAME=\"${CMAKE_INSTALL_LIBDIR}\""
+ "RUNPREFIX=\"${MYTH_RUN_PREFIX}\";LIBDIRNAME=\"${CMAKE_INSTALL_LIBDIR}\""
)
target_include_directories(
mythbase |
I think that would work, though I'll need to wait until this weekend to try it. The following also references the resulting run prefix so that may be another place to use mythtv/mythtv/cmake/PrintConfig.cmake Line 63 in 683d1a4
|
The code previously always assigned CMAKE_INSTALL_PREFIX to RUNPREFIX, the location that the mythfrontend believes is its location. Add a new option, MYTH_RUN_PREFIX, allowing this variable to be specified when the build tree is created. This is analogous to the configure --runprefix option. Refs: #980
Let me know how the testing goes. I'll leave the issue open for now in case you need further tweaks. |
I was able to rebuild with 31ea30c atop fixes/34 and the patch works beautifully. If this qualifies for backport, I'd appreciate it. Thank you @linuxdude42. |
The code previously always assigned CMAKE_INSTALL_PREFIX to RUNPREFIX, the location that the mythfrontend believes is its location. Add a new option, MYTH_RUN_PREFIX, allowing this variable to be specified when the build tree is created. This is analogous to the configure --runprefix option. Refs: #980 (cherry picked from commit 31ea30c)
Is your feature request related to a problem? Please describe.
The CMake build assumes write access to
CMAKE_INSTALL_PREFIX
. Packages are typically built for redistribution and prependDESTDIR
toCMAKE_INSTALL_PREFIX
. In that way, the package can be "installed" in a temporary buildroot while maintaining the runtime prefix ofCMAKE_INSTALL_PREFIX
after they are packaged and installed on other systems.Describe the solution you'd like
The CMake system needs to be updated to install to
${DESTDIR}${CMAKE_INSTALL_PREFIX}
during the build so it can be packaged properly.Describe alternatives you've considered
I've tried setting
CMAKE_INSTALL_PREFIX
to a place in the builddir (/builddir/build/BUILD/mythtv-34.0-build/install
) then moving that install location to/usr
which fails at runtime (on another computer) as the runtime prefix is also set to/builddir/build/BUILD/mythtv-34.0-build/install
and I get errors like the following as of course it should be looking in/usr/lib64/mythtv/plugins
:The text was updated successfully, but these errors were encountered: