Skip to content

Commit

Permalink
builds(deps): use miniupnpc package instead of submodule (#1971)
Browse files Browse the repository at this point in the history
Co-authored-by: Cameron Gutman <aicommander@gmail.com>
  • Loading branch information
ReenigneArcher and cgutman authored Jan 1, 2024
1 parent a452402 commit c0164ca
Show file tree
Hide file tree
Showing 20 changed files with 67 additions and 36 deletions.
1 change: 1 addition & 0 deletions .codeql-prebuild-cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ sudo apt-get install -y \
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libminiupnpc-dev \
libmfx-dev \
libnotify-dev \
libnuma-dev \
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ jobs:
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libminiupnpc-dev \
libmfx-dev \
libnotify-dev \
libnuma-dev \
Expand Down Expand Up @@ -425,7 +426,9 @@ jobs:
fi
- name: Set AppImage Version
if: ${{ matrix.type == 'AppImage' && ( needs.check_changelog.outputs.next_version_bare != needs.check_changelog.outputs.last_version ) }} # yamllint disable-line rule:line-length
if: |
matrix.type == 'AppImage' &&
(needs.check_changelog.outputs.next_version_bare != needs.check_changelog.outputs.last_version)
run: |
version=${{ needs.check_changelog.outputs.next_version_bare }}
echo "VERSION=${version}" >> $GITHUB_ENV
Expand Down Expand Up @@ -516,7 +519,7 @@ jobs:
- name: Setup Dependencies MacOS
run: |
# install dependencies using homebrew
brew install cmake curl node openssl opus pkg-config
brew install cmake curl miniupnpc node openssl opus pkg-config
# fix openssl header not found
# ln -sf /usr/local/opt/openssl/include/openssl /usr/local/include/openssl
Expand All @@ -530,6 +533,10 @@ jobs:
ln -sf $(find /usr/local/Cellar -type d -name "opus" -path "*/opus/*/include" | head -n 1) \
/usr/local/include/opus
# fix miniupnpc header not found
ln -sf $(find /usr/local/Cellar -type d -name "miniupnpc" -path "*/miniupnpc/*/include" | head -n 1) \
/usr/local/include/miniupnpc
- name: Install Boost
# installing boost from homebrew takes 30 minutes in a GitHub runner
run: |
Expand Down Expand Up @@ -757,6 +764,7 @@ jobs:
mingw-w64-x86_64-boost
mingw-w64-x86_64-cmake
mingw-w64-x86_64-curl
mingw-w64-x86_64-miniupnpc
mingw-w64-x86_64-nodejs
mingw-w64-x86_64-nsis
mingw-w64-x86_64-onevpl
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
path = third-party/ViGEmClient
url = https://github.com/nefarius/ViGEmClient
branch = master
[submodule "third-party/miniupnp"]
path = third-party/miniupnp
url = https://github.com/miniupnp/miniupnp
branch = master
[submodule "third-party/nv-codec-headers"]
path = third-party/nv-codec-headers
url = https://github.com/FFmpeg/nv-codec-headers
Expand Down
4 changes: 4 additions & 0 deletions cmake/compile_definitions/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ add_definitions(-DCURL_STATICLIB)
include_directories(SYSTEM ${CURL_STATIC_INCLUDE_DIRS})
link_directories(${CURL_STATIC_LIBRARY_DIRS})

# miniupnpc
add_definitions(-DMINIUPNP_STATICLIB)

# extra tools/binaries for audio/display devices
add_subdirectory(tools) # todo - this is temporary, only tools for Windows are needed, for now

Expand Down Expand Up @@ -70,6 +73,7 @@ list(PREPEND PLATFORM_LIBRARIES
userenv
synchronization.lib
avrt
iphlpapi
${CURL_STATIC_LIBRARIES})

if(SUNSHINE_ENABLE_TRAY)
Expand Down
22 changes: 2 additions & 20 deletions cmake/dependencies/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,8 @@ find_package(Threads REQUIRED)
pkg_check_modules(CURL REQUIRED libcurl)

# miniupnp
if(SUNSHINE_SYSTEM_MINIUPNP)
pkg_check_modules(MINIUPNP miniupnpc REQUIRED)

# Use includedir pkg-config variable rather than MINIUPNP_INCLUDE_DIRS
# defined above. The latter may be blank, as pkg-config sometimes omits -I
# flags for directories that are searched by default (e.g. /usr/include),
# but we need a value to append /miniupnpc to. Normally source files would
# prefix their #include directives with miniupnpc/, but this does not align
# with the directory structure of the git submodule used below.
pkg_get_variable(MINIUPNP_INCLUDE_DIR miniupnpc includedir)
include_directories(SYSTEM ${MINIUPNP_INCLUDE_DIR}/miniupnpc)
else()
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "No shared libraries")
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Don't build tests for miniupnpc")
set(UPNPC_BUILD_SAMPLE OFF CACHE BOOL "Don't build samples for miniupnpc")
set(UPNPC_NO_INSTALL ON CACHE BOOL "Don't install any libraries build for miniupnpc")
set(MINIUPNP_LIBRARIES libminiupnpc-static)
add_subdirectory(third-party/miniupnp/miniupnpc)
include_directories(SYSTEM third-party/miniupnp/miniupnpc/include)
endif()
pkg_check_modules(MINIUPNP miniupnpc REQUIRED)
include_directories(SYSTEM ${MINIUPNP_INCLUDE_DIRS})

# ffmpeg pre-compiled binaries
if(WIN32)
Expand Down
1 change: 0 additions & 1 deletion cmake/prep/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF)
option(SUNSHINE_ENABLE_TRAY "Enable system tray icon. This option will be ignored on macOS." ON)
option(SUNSHINE_REQUIRE_TRAY "Require system tray icon. Fail the build if tray requirements are not met." ON)

option(SUNSHINE_SYSTEM_MINIUPNP "Use system installation of MiniUPnP rather than the submodule." OFF)
option(SUNSHINE_SYSTEM_WAYLAND_PROTOCOLS "Use system installation of wayland-protocols rather than the submodule." OFF)

if(APPLE)
Expand Down
1 change: 1 addition & 0 deletions docker/debian-bookworm.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ apt-get install -y --no-install-recommends \
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libminiupnpc-dev \
libnotify-dev \
libnuma-dev \
libopus-dev \
Expand Down
1 change: 1 addition & 0 deletions docker/debian-bullseye.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ apt-get install -y --no-install-recommends \
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libminiupnpc-dev \
libnotify-dev \
libnuma-dev \
libopus-dev \
Expand Down
1 change: 1 addition & 0 deletions docker/fedora-38.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dnf -y install \
libXrandr-devel \
libXtst-devel \
mesa-libGL-devel \
miniupnpc-devel \
nodejs \
numactl-devel \
openssl-devel \
Expand Down
1 change: 1 addition & 0 deletions docker/fedora-39.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dnf -y install \
libXrandr-devel \
libXtst-devel \
mesa-libGL-devel \
miniupnpc-devel \
nodejs \
numactl-devel \
openssl-devel \
Expand Down
1 change: 1 addition & 0 deletions docker/ubuntu-20.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ apt-get install -y --no-install-recommends \
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libminiupnpc-dev \
libnotify-dev \
libnuma-dev \
libopus-dev \
Expand Down
1 change: 1 addition & 0 deletions docker/ubuntu-22.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ apt-get install -y --no-install-recommends \
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libminiupnpc-dev \
libnotify-dev \
libnuma-dev \
libopus-dev \
Expand Down
4 changes: 4 additions & 0 deletions docs/source/building/linux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Install Requirements
libcurl4-openssl-dev \
libdrm-dev \ # KMS
libevdev-dev \
libminiupnpc-dev \
libmfx-dev \ # x86_64 only
libnotify-dev \
libnuma-dev \
Expand Down Expand Up @@ -77,6 +78,7 @@ Install Requirements
libXrandr-devel \ # X11
libXtst-devel \ # X11
mesa-libGL-devel \
miniupnpc-devel \
npm \
numactl-devel \
openssl-devel \
Expand Down Expand Up @@ -106,6 +108,7 @@ Install Requirements
libcap-dev \ # KMS
libdrm-dev \ # KMS
libevdev-dev \
libminiupnpc-dev \
libmfx-dev \ # x86_64 only
libnotify-dev \
libnuma-dev \
Expand Down Expand Up @@ -155,6 +158,7 @@ Install Requirements
libcap-dev \ # KMS
libdrm-dev \ # KMS
libevdev-dev \
libminiupnpc-dev \
libmfx-dev \ # x86_64 only
libnotify-dev \
libnuma-dev \
Expand Down
4 changes: 2 additions & 2 deletions docs/source/building/macos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ MacPorts
Install Requirements
.. code-block:: bash
sudo port install avahi boost180 cmake curl libopus npm9 pkgconfig
sudo port install avahi boost180 cmake curl libopus miniupnpc npm9 pkgconfig
Homebrew
""""""""
Install Requirements
.. code-block:: bash
brew install boost cmake node opus pkg-config
brew install boost cmake miniupnpc node opus pkg-config
# if there are issues with an SSL header that is not found:
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
Expand Down
21 changes: 17 additions & 4 deletions docs/source/building/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@ Update all packages:
Install dependencies:
.. code-block:: bash
pacman -S base-devel cmake diffutils gcc git make mingw-w64-x86_64-binutils \
mingw-w64-x86_64-boost mingw-w64-x86_64-cmake mingw-w64-x86_64-curl \
mingw-w64-x86_64-nodejs mingw-w64-x86_64-onevpl mingw-w64-x86_64-openssl \
mingw-w64-x86_64-opus mingw-w64-x86_64-toolchain
pacman -S \
base-devel \
cmake \
diffutils \
gcc \
git \
make \
mingw-w64-x86_64-binutils \
mingw-w64-x86_64-boost \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-curl \
mingw-w64-x86_64-miniupnpc \
mingw-w64-x86_64-nodejs \
mingw-w64-x86_64-onevpl \
mingw-w64-x86_64-openssl \
mingw-w64-x86_64-opus \
mingw-w64-x86_64-toolchain
Build
-----
Expand Down
1 change: 1 addition & 0 deletions packaging/linux/Arch/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ depends=('avahi'
'libxfixes'
'libxrandr'
'libxtst'
'miniupnpc'
'numactl'
'openssl'
'opus'
Expand Down
17 changes: 17 additions & 0 deletions packaging/linux/flatpak/dev.lizardbyte.sunshine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,23 @@ modules:
commands:
- for n in $(cat patches/series); do if [[ $n != "#"* ]]; then patch -Np1 -i "patches/$n" -d .; fi; done

- name: miniupnpc
buildsystem: cmake
config-opts:
- -DUPNPC_BUILD_SAMPLE=OFF
- -DUPNPC_BUILD_SHARED=ON
- -DUPNPC_BUILD_TESTS=OFF
sources:
- type: archive
url: http://archive.ubuntu.com/ubuntu/pool/main/m/miniupnpc/miniupnpc_2.2.5.orig.tar.gz
sha256: 38acd5f4602f7cf8bcdc1ec30b2d58db2e9912e5d9f5350dd99b06bfdffb517c
- type: archive
url: http://archive.ubuntu.com/ubuntu/pool/main/m/miniupnpc/miniupnpc_2.2.5-1.debian.tar.xz
sha256: f6ab181f3c999ae0630508ea1e6c76ae302262414061acaab12bf8763431ffd1
- type: shell
commands:
- for n in $(cat patches/series); do if [[ $n != "#"* ]]; then patch -Np1 -i "patches/$n" -d .; fi; done

- name: numactl
buildsystem: autotools
make-args:
Expand Down
1 change: 1 addition & 0 deletions packaging/macos/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ post-fetch {
depends_lib port:avahi \
port:curl \
port:libopus \
port:miniupnpc \
port:npm9 \
port:pkgconfig

Expand Down
4 changes: 2 additions & 2 deletions src/upnp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @file src/upnp.cpp
* @brief todo
*/
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>

#include "config.h"
#include "confighttp.h"
Expand Down
1 change: 0 additions & 1 deletion third-party/miniupnp
Submodule miniupnp deleted from fb5c32

0 comments on commit c0164ca

Please sign in to comment.