Skip to content

Commit

Permalink
Merge branch 'MythTV:master' into hambre/play-audio-cd-from-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
hambre authored Jan 19, 2025
2 parents f0acb3b + 5959411 commit b972e76
Show file tree
Hide file tree
Showing 105 changed files with 2,877 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ CheckOptions:
- { key: performance-inefficient-vector-operation.VectorLikeClasses,
value: '::std::vector,QList,QByteArrayList,QItemSelection,QQueue,QStringList' }

- { key: readability-braces-around-statements.ShortStatementLines, value: 3 }
- { key: readability-braces-around-statements.ShortStatementLines, value: 4 }
- { key: readability-implicit-bool-conversion.AllowPointerConditions, value: 1 }
- { key: readability-implicit-bool-conversion.AllowIntegerConditions, value: 1 }
- { key: readability-inconsistent-declaration-parameter-name.strict, value: 1 }
Expand Down
98 changes: 51 additions & 47 deletions .github/workflows/build-mythtv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,23 +306,27 @@ jobs:
- desc: 'macOS 13 (Ventura) x86_64'
runner: 'macOS-13'
arch: 'x86_64'
python_dot_version: '3.13'
qt_version: 'qt5'
database_version: 'mysql8'
qt_version: 'qt6'
database_version: 'mariadb'
extrapkgs: ''
configureopts: '--disable-firewire --enable-libmp3lame --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-bdjava'
linkerflags: '-Wl,-ld_classic'
cross_compile: false
- desc: 'macOS 14 (Sonoma) arm64'
runner: 'macOS-14'
arch: 'arm64'
python_dot_version: '3.13'
qt_version: 'qt5'
database_version: 'mysql8'
qt_version: 'qt6'
database_version: 'mariadb'
extrapkgs: ''
configureopts: '--disable-firewire --enable-libmp3lame --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-bdjava'
linkerflags: '-Wl,-ld_classic'
- desc: 'macOS 15 (Sequoia) arm64'
runner: 'macOS-15'
arch: 'arm64'
qt_version: 'qt6'
database_version: 'mariadb'
extrapkgs: ''
configureopts: '--disable-firewire --enable-libmp3lame --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-bdjava'
linkerflags: '-Wl,-ld_classic'
cross_compile: false

compiler:
- desc: 'clang'
Expand All @@ -337,10 +341,10 @@ jobs:
TZ: Etc/UTC
MYTHTV_CONFIG_PREFIX: "${{ github.workspace }}/build/install"
MYTHTV_CONFIG_EXTRA: "--cc=${{ matrix.compiler.cc }} --cxx=${{ matrix.compiler.cxx }} --compile-type=release --enable-debug=0 --disable-debug"
MYTHPLUGINS_EXTRA: "--disable-mytharchive --disable-mythnetvision --disable-mythzoneminder --disable-mythzmserver"
CCACHE_DIR: $HOME/.ccache
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 250M
ANSIBLE_CMD: "ansible-playbook-${{ matrix.os.python_dot_version }}"
CONFIGURE_CMD: "./configure"
MAKE_CMD: 'make'
ANSIBLE_EXTRA: ''
Expand All @@ -353,33 +357,36 @@ jobs:
key: ${{ matrix.os.desc }}-${{ matrix.compiler.desc }}-build-core-ccache-${{ github.sha }}
restore-keys: ${{ matrix.os.desc }}-${{ matrix.compiler.desc }}-build-core-ccache

- name: Bootstrap Macports
env:
GH_URL: "https://raw.githubusercontent.com"
MP_URL: "GiovanniBussi/macports-ci/master/macports-ci"
- name: Update Homebrew Environment
run: |
PKGMGR_PREFIX=/opt/local
brew update && brew upgrade
PKGMGR_PREFIX=$(brew --prefix)
echo "PKGMGR_PREFIX=$PKGMGR_PREFIX" >> $GITHUB_ENV
curl -LJO "${GH_URL}/${MP_URL}"
arch -${{ matrix.os.arch }} bash -c "source ./macports-ci install"
export PATH=${PKGMGR_PREFIX}/bin:${PKGMGR_PREFIX}/libexec/${{ matrix.os.qt_version }}/bin:${PKGMGR_PREFIX}/sbin:$PATH
echo "PKGMGR_CMD=sudo $PKGMGR_PREFIX/bin/port" >> $GITHUB_ENV
- name: Remove Homebrew
env:
GH_URL: "https://raw.githubusercontent.com"
HB_URL: "Homebrew/install/HEAD/uninstall.sh"
- name: Fix Python install on Ventura
run: |
echo "Force remove currently installed python"
brew unlink python
brew unlink python3
brew remove --force --ignore-dependencies python3
echo "re-install requested python"
brew install --force --overwrite python3
if: matrix.os.runner == 'macOS-13'

- name: Install Ansible and missing Python necessities
run: |
/bin/bash -c "$(curl -fsSL ${GH_URL}/${HB_URL})" --force
sudo rm -Rf /usr/local/bin/brew
brew install ansible python-setuptools python-packaging
- name: Setup cross-compile environment
- name: Setup Python and Ansible Variables
run: |
echo "PKGMGR_CMD=arch -${{ matrix.os.arch }} sudo ${PKGMGR_PREFIX}/bin/port" >> $GITHUB_ENV
echo "ANSIBLE_CMD=arch -${{ matrix.os.arch }} $ANSIBLE_CMD" >> $GITHUB_ENV
echo "CONFIGURE_CMD=arch -${{ matrix.os.arch }} $CONFIGURE_CMD" >> $GITHUB_ENV
echo "MAKE_CMD=arch -${{ matrix.os.arch }} $MAKE_CMD" >> $GITHUB_ENV
if: matrix.os.cross_compile
PYTHON_EXE=$PKGMGR_PREFIX/bin/python3
PYTHON_VERSION=$(${PYTHON_EXE} -c "import sys; print(str(sys.version_info.major)+str(sys.version_info.minor))")
PYTHON_DOT_VERSION=$(${PYTHON_EXE} -c "import sys; print(str(sys.version_info.major)+'.'+str(sys.version_info.minor))")
ANSIBLE_EXTRA="ansible_python_interpreter=$PYTHON_EXE database_version=${{ matrix.os.database_version }}"
echo "PYTHON_EXE=$PYTHON_EXE" >> $GITHUB_ENV
echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_ENV
echo "PYTHON_DOT_VERSION=$PYTHON_DOT_VERSION" >> $GITHUB_ENV
echo "ANSIBLE_EXTRA=$ANSIBLE_EXTRA" >> $GITHUB_ENV
- name: Setup build envinomental variables
run: |
Expand All @@ -388,18 +395,7 @@ jobs:
echo "LDFLAGS=-L${PKGMGR_PREFIX}/lib ${{ matrix.os.linkerflags }}" >> $GITHUB_ENV
echo "LIBRARY_PATH=${PKGMGR_PREFIX}/lib" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${PKGMGR_PREFIX}/lib/pkgconfig" >> $GITHUB_ENV
echo "QMAKE_CMD=${PKGMGR_PREFIX}/libexec/${{ matrix.os.qt_version }}/bin/qmake" >> $GITHUB_ENV
- name: Install ansible, pip, and virtualenv
run: |
PYTHON_VERSION=${{ matrix.os.python_dot_version }}
PYTHON_VERSION=${PYTHON_VERSION//.}
${PKGMGR_CMD} install py${PYTHON_VERSION}-ansible py${PYTHON_VERSION}-pip py${PYTHON_VERSION}-virtualenv
${PKGMGR_CMD} select --set python python${PYTHON_VERSION}
${PKGMGR_CMD} select --set python3 python${PYTHON_VERSION}
${PKGMGR_CMD} select --set ansible py${PYTHON_VERSION}-ansible
ANSIBLE_EXTRA="ansible_python_interpreter=${PKGMGR_PREFIX}/bin/python${{ matrix.os.python_dot_version }} database_version=${{ matrix.os.database_version }}"
echo "ANSIBLE_EXTRA=$ANSIBLE_EXTRA" >> $GITHUB_ENV
echo "QMAKE_CMD=${PKGMGR_PREFIX}/opt/${{ matrix.os.qt_version }}/bin/qmake" >> $GITHUB_ENV
- name: Setup qt6 variables
run: echo "ANSIBLE_EXTRA=$ANSIBLE_EXTRA qt6=true" >> $GITHUB_ENV
Expand All @@ -413,11 +409,11 @@ jobs:

- name: Run ansible to install build requirements
working-directory: ansible
run: ${ANSIBLE_CMD} mythtv.yml --extra-vars="$ANSIBLE_EXTRA" --limit localhost
run: ansible-playbook mythtv.yml --extra-vars="$ANSIBLE_EXTRA" --limit localhost

- name: Update MYSQL environmental variables
run: |
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${PKGMGR_PREFIX}/lib/${{ matrix.os.database_version }}/pkgconfig/
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${PKGMGR_PREFIX}/opt/mysql-client/lib/pkgconfig/
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
MYSQLCLIENT_LDFLAGS="$(${PKGMGR_PREFIX}/bin/pkg-config --libs mysqlclient)"
echo "MYSQLCLIENT_LDFLAGS=$MYSQLCLIENT_LDFLAGS" >> $GITHUB_ENV
Expand All @@ -426,10 +422,18 @@ jobs:
- name: Source the virtual python environemnt
run: |
PYTHON_VENV_PATH="$HOME/.mythtv/python-virtualenv"
PYTHON_VENV_PATH="$HOME/.mythtv/python-venv$PYTHON_VERSION"
source "${PYTHON_VENV_PATH}/bin/activate"
echo "PYTHON_CMD=${PYTHON_VENV_PATH}/bin/python3" >> $GITHUB_ENV
- name: Fix the HDHomeRun library on ARM64
run: ln -s $PKGMGR_PREFIX/opt/libhdhomerun/lib/libhdhomerun.dylib $PKGMGR_PREFIX/opt/libhdhomerun/lib/libhdhomerun_arm64.dylib
if: matrix.os.arch == 'arm64'

- name: Fix the HDHomeRun library on ARM64
run: ln -s $PKGMGR_PREFIX/opt/libhdhomerun/lib/libhdhomerun.dylib $PKGMGR_PREFIX/opt/libhdhomerun/lib/libhdhomerun_x64.dylib
if: matrix.os.arch == 'x86_64'

- name: Checkout Mythtv/mythtv repository
uses: actions/checkout@v4
with:
Expand All @@ -456,7 +460,7 @@ jobs:

- name: Configure plugins
working-directory: mythtv/mythplugins
run: ${CONFIGURE_CMD} --prefix=${MYTHTV_CONFIG_PREFIX}
run: ${CONFIGURE_CMD} --prefix=${MYTHTV_CONFIG_PREFIX} ${MYTHPLUGINS_EXTRA}

- name: Make plugins
working-directory: mythtv/mythplugins
Expand Down
1 change: 1 addition & 0 deletions cmake/MiscellaneousTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ configure_file(cmake/files/tags_tools.cmake.in tags_tools.cmake @ONLY)
function(add_misc_runtime_target NAME)
add_custom_target(${NAME})
add_custom_command(
POST_BUILD
TARGET ${NAME}
COMMAND ${CMAKE_COMMAND} -P tags_tools.cmake ${NAME}
VERBATIM USES_TERMINAL)
Expand Down
23 changes: 23 additions & 0 deletions cmake/MythOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,29 @@ set(MYTH_JAVA_HOME
"Path to JDK home directory. This will be used if the JAVA_HOME environment variable isn't set."
)

#
# Darwin Related Options
#
if(APPLE)
option(DARWIN_FRONTEND_BUNDLE
"Generate an application bundle for mythfrontend." OFF)
option(DARWIN_SIGNING_ID
"\
The name of your Apple supplied code signing certificate \
for the application. The name usually takes the form \
Developer ID Application: [Name] or \
3rd Party Mac Developer Application: [Name] \
If this variable is not set the application will not be signed." "")
option(DARWIN_NOTARIZATION_KEYCHAIN
"\
Keychain where valid apple notarization credentials are stored.\
These include the apple-id, team-id, and the Apple Generated APP_PWD\
These can be stored by running the following command:\
xcrun notarytool store-credentials KEYCHAIN_NAME \
--apple-id YOUR_APPLE_ID \
--team-id=YOUR_TEAM_ID \
--password YOUR_APP_PWD" "")
endif()
#
# Load any user overrides to these values.
#
Expand Down
6 changes: 4 additions & 2 deletions cmake/StaticAnalysis.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ function(sa_super)
# sub-projects.
ExternalProject_Get_Property(MythTV BINARY_DIR)
set(MythTV_BINARY_DIR ${BINARY_DIR})
ExternalProject_Get_Property(MythPlugins BINARY_DIR)
set(MythPlugins_BINARY_DIR ${BINARY_DIR})
if(MYTH_BUILD_PLUGINS)
ExternalProject_Get_Property(MythPlugins BINARY_DIR)
set(MythPlugins_BINARY_DIR ${BINARY_DIR})
endif()

# CMake always builds a compile_commands.json file in the binary
# directory. Add support for combining these into a single
Expand Down
78 changes: 56 additions & 22 deletions cmake/platform/DarwinCustomization.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ check_language(OBJCXX)
# MacPorts or Homebrew?
execute_process(
COMMAND which port
RESULT_VARIABLE DETECT_MACPORTS
RESULT_VARIABLE _DETECT_MACPORTS
OUTPUT_VARIABLE MACPORTS_PREFIX
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND brew --prefix
RESULT_VARIABLE DETECT_HOMEBREW
RESULT_VARIABLE _DETECT_HOMEBREW
OUTPUT_VARIABLE HOMEBREW_PREFIX
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(DETECT_MACPORTS EQUAL 0)
if(_DETECT_MACPORTS EQUAL 0)
# The MACPORTS_PREFIX variable should contain a path name like
# "/opt/local/bin/port". Go up two levels to find the "root" directory for
# macports.
Expand All @@ -36,8 +36,8 @@ if(DETECT_MACPORTS EQUAL 0)
include_directories(AFTER SYSTEM "${MACPORTS_PREFIX}/include")

# FFmpeg needs a little help in finding the mp3lame library.
list(APPEND FF_PLATFORM_ARGS "--extra-ldflags=-L${MACPORTS_PREFIX}/lib"
"--extra-cflags=-I${MACPORTS_PREFIX}/include")
list(APPEND FF_C_CXX_FLAGS "-I${MACPORTS_PREFIX}/include")
list(APPEND FF_LD_FLAGS "-L${MACPORTS_PREFIX}/lib")

# Qt6 builds need a little help finding the libraries.
set(_QT_BASE "${MACPORTS_PREFIX}/libexec/${QT_PKG_NAME_LC}")
Expand All @@ -54,17 +54,19 @@ if(DETECT_MACPORTS EQUAL 0)
# Informational in case needed elsewhere.
message(STATUS "Detected MacPorts (${MACPORTS_PREFIX})")
set(MACPORTS ON)
elseif(DETECT_HOMEBREW EQUAL 0)
elseif(_DETECT_HOMEBREW EQUAL 0)
# Add homebrew specific include and lib directories.
link_directories(AFTER "${HOMEBREW_PREFIX}/lib")
include_directories(AFTER SYSTEM "${HOMEBREW_PREFIX}/include")

# FFmpeg needs a little help in finding the mp3lame library.
list(APPEND FF_PLATFORM_ARGS "--extra-ldflags=-L${HOMEBREW_PREFIX}/lib"
"--extra-cflags=-I${HOMEBREW_PREFIX}/include")
list(APPEND FF_C_CXX_FLAGS "-I${HOMEBREW_PREFIX}/include")
list(APPEND FF_LD_FLAGS "-L${HOMEBREW_PREFIX}/lib")

# Qt6 builds need a little help finding the libraries.
set(_QT_BASE "${HOMEBREW_PREFIX}/opt/${QT_PKG_NAME_LC}")
# Homebrew needs a little help finding the QT libraries due to the the HB
# naming convention which uses an @ symbol
set(QT_PKG_NAME_HB "qt@${QT_VERSION_MAJOR}")
set(_QT_BASE "${HOMEBREW_PREFIX}/opt/${QT_PKG_NAME_HB}")

# Provide the default Homebrew location for Python3, if the the user hasn't
# already specified a value in their options override file. This prevents
Expand Down Expand Up @@ -92,7 +94,16 @@ elseif(DETECT_HOMEBREW EQUAL 0)
set(HOMEBREW ON)
else()
message(FATAL_ERROR "Not building with MacPorts or Homebrew.")
endif(DETECT_MACPORTS EQUAL 0)
endif(_DETECT_MACPORTS EQUAL 0)

# Check to see if a python virtual environment is set, and if so
# tell cmake to use those site-packages instead of the default
# Macports or Homebrew python versions.
if(DEFINED ENV{VIRTUAL_ENV})
#set (CMAKE_FIND_FRAMEWORK NEVER)
set (Python3_FIND_VIRTUALENV ONLY)
set(Python3_ROOT_DIR $ENV{VIRTUAL_ENV})
endif()

# Qt6 builds need a little help finding the libraries.
list(APPEND CMAKE_FRAMEWORK_PATH "${_QT_BASE}")
Expand All @@ -108,18 +119,41 @@ list(APPEND CMAKE_MODULE_PATH "${_QT_BASE}/lib/cmake")
# missing include files. The include file warnings are solved by the
# extra -I argument below.
# ~~~
if("${CMAKE_C_COMPILER}" MATCHES "Xcode")
#
# depending on if commandline tools are installed, the developer root
# may be /Applications/Xcode or /Library/Developer/CommandLineTools
# check for a compiler match in either, then use CMAKE_OSX_SYSROOT to path the
# correct system indlude, sysroot, syslibroot, and library search paths
if("${CMAKE_C_COMPILER}" MATCHES "Xcode" OR "${CMAKE_C_COMPILER}" MATCHES "CommandLineTools")
if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 13)
# depending on if commandline tools are installed, the developer root
# may be /Applications/Xcode or /Library/Developer/CommandLineTools
message(STATUS "Adding Apple Clang '-lSystem' hack")
list(
APPEND
FF_PLATFORM_ARGS
"--extra-ldflags=-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
)
list(
APPEND
FF_PLATFORM_ARGS
"--extra-cflags=-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
)

list(APPEND FF_C_CXX_FLAGS "-I${CMAKE_OSX_SYSROOT}/usr/include"
"-isysroot${CMAKE_OSX_SYSROOT}")

list(APPEND FF_LD_FLAGS "-L${CMAKE_OSX_SYSROOT}/usr/lib"
"-Wl,-syslibroot,${CMAKE_OSX_SYSROOT}")
endif()
endif()

# Loop over the added C and CXX flags adding flags for both
# extra and host for c and cxx/cpp inputs
foreach(FLAG IN LISTS FF_C_CXX_FLAGS)
list(APPEND FF_PLATFORM_ARGS "--extra-cflags=${FLAG}"
"--host-cflags=${FLAG}"
"--extra-cxxflags=${FLAG}"
"--host-cppflags=${FLAG}")
endforeach()

# Loop over the added LDFLAGS adding flags for both extra and host
foreach(FLAG IN LISTS FF_LD_FLAGS)
list(APPEND FF_PLATFORM_ARGS "--extra-ldflags=${FLAG}"
"--host-ldflags=${FLAG}")
endforeach()

# if we're signing an application, bundling must be enabled
if (DARWIN_GENERATE_DISTRIBUTION AND NOT DARWIN_FRONTEND_BUNDLE)
message(FATAL_ERROR "Error: Generating a Drag And Drop Installer requires at least one App Bundle to be made.")
endif()
36 changes: 36 additions & 0 deletions cmake/platform/DarwinPackaging.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# Copyright (C) 2022-2024 John Hoyt
#
# See the file LICENSE_FSF for licensing information.
#

if(NOT APPLE)
return()
endif()
if (NOT DARWIN_FRONTEND_BUNDLE)
return()
endif()

set(CMAKE_MACOSX_BUNDLE ON)

# Build a macOS app bundle
ExternalProject_Add(
PackageDarwin
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platform/darwin
CMAKE_ARGS ${CMDLINE_ARGS}
${PLATFORM_ARGS}
${USES_QT_PLATFORM_ARGS}
-DQT_VERSION_MAJOR:STRING=${QT_VERSION_MAJOR}
-DSUPER_VERSION=${PROJECT_VERSION}
-DSUPER_SOURCE_DIR=${PROJECT_SOURCE_DIR}
-DMYTHTV_SOURCE_VERSION=${MYTHTV_SOURCE_VERSION}
CMAKE_CACHE_ARGS
-DCMAKE_FIND_ROOT_PATH:STRING=${CMAKE_FIND_ROOT_PATH}
-DCMAKE_JOB_POOL_COMPILE:STRING=compile
-DCMAKE_JOB_POOL_LINK:STRING=link
-DCMAKE_JOB_POOLS:STRING=${CMAKE_JOB_POOLS}
-DPKG_CONFIG_LIBDIR:PATH=${PKG_CONFIG_LIBDIR}
-DPKG_CONFIG_PATH:PATH=${PKG_CONFIG_PATH}
USES_TERMINAL_CONFIGURE TRUE
USES_TERMINAL_BUILD TRUE
DEPENDS MythTV MythPlugins)
Loading

0 comments on commit b972e76

Please sign in to comment.