Skip to content
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

Fix: homebrew CI build, macOS ARM64 with Xcode 16, Boost.JSON build via CMake #444

Merged
merged 31 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
50068aa
Try to use ExternalProject_add instead of FetchContent
dnzbk Nov 20, 2024
100726c
Fix typo and build with latest CLang
dnzbk Nov 20, 2024
e597d71
cleanup
dnzbk Nov 20, 2024
c75a848
cleanup
dnzbk Nov 20, 2024
0e5f2ef
Merge branch 'fix/brew-build' of https://github.com/nzbgetcom/nzbget …
dnzbk Nov 22, 2024
ec350c1
fixing build on macOS
dnzbk Nov 22, 2024
4c84c6e
FreeBSD - add log upload on build failure
phnzb Nov 22, 2024
51fdf97
use CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR
dnzbk Nov 22, 2024
8c1fd07
Fix build log path
phnzb Nov 22, 2024
ec444ff
Merge branch 'fix/brew-build' of github.com:nzbgetcom/nzbget into fix…
phnzb Nov 22, 2024
f86de53
test
dnzbk Nov 22, 2024
e4c0ba2
without toolchain
dnzbk Nov 22, 2024
86fdf46
Add upload logs on failure for all platforms
phnzb Nov 22, 2024
4cc558f
Merge branch 'fix/brew-build' of github.com:nzbgetcom/nzbget into fix…
phnzb Nov 22, 2024
e33671c
Add upload logs to universal osx
phnzb Nov 22, 2024
c6d46a6
with CMAKE_GENERATOR_PLATFORM
dnzbk Nov 22, 2024
72db72c
try to use prefix
dnzbk Nov 22, 2024
d04206e
use compiler target
dnzbk Nov 22, 2024
c7fb2ad
test
dnzbk Nov 22, 2024
6b4e0cb
try to use CMAKE_OSX_ARCHS
dnzbk Nov 22, 2024
2168e46
try to override CMAKE_SYSTEM_NAME
dnzbk Nov 22, 2024
562f9aa
fix linux build
dnzbk Nov 22, 2024
dd8b4aa
test
dnzbk Nov 22, 2024
be51866
try to fix bsd build
dnzbk Nov 22, 2024
c5b579b
Fix freebsd build
phnzb Nov 22, 2024
e9f8534
Merge branch 'fix/brew-build' of github.com:nzbgetcom/nzbget into fix…
phnzb Nov 22, 2024
b9a3b38
Add conditionals to par2-turbo
phnzb Nov 22, 2024
c4035a7
Update par2-turbo conditionals
phnzb Nov 22, 2024
4fe411b
Update build script and disable ncursesw for macOS
phnzb Nov 22, 2024
34d3647
update nzbget.h, cleanup tests
dnzbk Nov 26, 2024
d3b0163
Delete nzbget dependency
dnzbk Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ jobs:
fi
bash linux/build-nzbget.sh $BUILD_PARAMS

- name: Upload full build log on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: nzbget-android-build-log
path: build/*/build.log
retention-days: 5

- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/freebsd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: freebsd build
name: freebsd build

on:
workflow_call:
Expand All @@ -9,7 +9,7 @@ jobs:
runs-on: [self-hosted, nzbget-freebsd]

steps:

- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -28,6 +28,14 @@ jobs:
fi
bash linux/build-nzbget.sh $BUILD_PARAMS

- name: Upload full build log on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: nzbget-freebsd-build-log
path: build/*/build.log
retention-days: 5

- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ jobs:
fi
bash linux/build-nzbget.sh $BUILD_PARAMS

- name: Upload full build log on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: nzbget-linux-build-log
path: build/*/build.log
retention-days: 5

- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ jobs:
bash osx/build-nzbget.sh x64
fi

- name: Upload full build log on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: nzbget-osx-x64-build-log
path: build/*/build.log
retention-days: 5

- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
Expand Down Expand Up @@ -59,6 +67,14 @@ jobs:
bash osx/build-nzbget.sh universal
fi

- name: Upload full build log on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: nzbget-osx-universal-build-log
path: build/*/build.log
retention-days: 5

- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ else()
endif()
endif()

include(lib/sources.cmake)

configure_file(
${CMAKE_SOURCE_DIR}/cmake/config.h.in
${CMAKE_BINARY_DIR}/config.h
Expand Down
4 changes: 2 additions & 2 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang")
add_compile_options(-Weverything)
add_compile_options(-Weverything -Wno-c++98-compat)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wall -Wextra)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
Expand All @@ -21,4 +21,4 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
endif()
endif()

include(FetchContent)
include(ExternalProject)
61 changes: 49 additions & 12 deletions cmake/par2-turbo.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,54 @@
set(FETCHCONTENT_QUIET FALSE)
FetchContent_Declare(
set(PAR2_ROOT ${CMAKE_BINARY_DIR}/par2-turbo/src)

add_compile_definitions(HAVE_CONFIG_H PARPAR_ENABLE_HASHER_MD5CRC)

set(CMAKE_ARGS
-DBUILD_TOOL=OFF
-DBUILD_LIB=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
)

if(APPLE)
set(CMAKE_ARGS ${CMAKE_ARGS}
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
)
endif()

if(CMAKE_SYSROOT)
set(CMAKE_ARGS ${CMAKE_ARGS}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_SYSROOT=${CMAKE_SYSROOT}
-DCMAKE_CXX_FLAGS=-I${CMAKE_SYSROOT}/usr/include/c++/v1
)
endif()

ExternalProject_add(
par2-turbo
GIT_REPOSITORY https://github.com/nzbgetcom/par2cmdline-turbo.git
GIT_TAG v1.1.1-nzbget
TLS_VERIFY TRUE
GIT_SHALLOW TRUE
PREFIX par2-turbo
GIT_REPOSITORY https://github.com/nzbgetcom/par2cmdline-turbo.git
GIT_TAG v1.1.1-nzbget
TLS_VERIFY TRUE
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
CMAKE_ARGS ${CMAKE_ARGS}
INSTALL_COMMAND ""
)

add_compile_definitions(HAVE_CONFIG_H PARPAR_ENABLE_HASHER_MD5CRC)
set(BUILD_TOOL OFF CACHE BOOL "")
set(BUILD_LIB ON CACHE BOOL "")
FetchContent_MakeAvailable(par2-turbo)
if(WIN32)
set(LIBS ${LIBS}
${PAR2_ROOT}/par2-turbo-build/${CMAKE_BUILD_TYPE}/par2-turbo.lib
${PAR2_ROOT}/par2-turbo-build/${CMAKE_BUILD_TYPE}/gf16.lib
${PAR2_ROOT}/par2-turbo-build/${CMAKE_BUILD_TYPE}/hasher.lib
)
else()
set(LIBS ${LIBS}
${PAR2_ROOT}/par2-turbo-build/libpar2-turbo.a
${PAR2_ROOT}/par2-turbo-build/libgf16.a
${PAR2_ROOT}/par2-turbo-build/libhasher.a
)
endif()

set(LIBS ${LIBS} par2-turbo gf16 hasher)
set(INCLUDES ${INCLUDES} ${par2_SOURCE_DIR}/include)
set(INCLUDES ${INCLUDES} ${PAR2_ROOT}/par2-turbo/include)
11 changes: 8 additions & 3 deletions cmake/posix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ else()

if(NOT DISABLE_CURSES)
set(CURSES_NEED_NCURSES TRUE)
set(CURSES_NEED_WIDE TRUE)
if(NOT APPLE)
set(CURSES_NEED_WIDE TRUE)
endif()
find_package(Curses REQUIRED)
set(INCLUDES ${INCLUDES} ${CURSES_INCLUDE_DIRS})
set(LIBS ${LIBS} ${CURSES_LIBRARIES})
Expand All @@ -113,16 +115,19 @@ else()
include(${CMAKE_SOURCE_DIR}/cmake/boost.cmake)

add_dependencies(${PACKAGE} boost)
add_dependencies(yencode boost)
add_dependencies(regex boost)
else()
set(LIBS ${LIBS} Boost::json)
set(INCLUDES ${INCLUDES} ${Boost_INCLUDE_DIR})
endif()
endif()

include(${CMAKE_SOURCE_DIR}/lib/sources.cmake)

if(NOT DISABLE_PARCHECK)
include(${CMAKE_SOURCE_DIR}/cmake/par2-turbo.cmake)
add_dependencies(${PACKAGE} par2-turbo)
add_dependencies(yencode par2-turbo)
add_dependencies(regex par2-turbo)
endif()

include(CheckIncludeFiles)
Expand Down
8 changes: 6 additions & 2 deletions cmake/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ find_package(Threads REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(Boost REQUIRED COMPONENTS json)

include(${CMAKE_SOURCE_DIR}/cmake/par2-turbo.cmake)

set(LIBS ${LIBS} Threads::Threads Boost::json LibXml2::LibXml2 winmm.lib)
set(INCLUDES ${INCLUDES} ${Boost_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR})

Expand All @@ -37,6 +35,12 @@ set(INCLUDES ${INCLUDES}
${CMAKE_SOURCE_DIR}/windows/resources
)

include(${CMAKE_SOURCE_DIR}/lib/sources.cmake)

include(${CMAKE_SOURCE_DIR}/cmake/par2-turbo.cmake)
add_dependencies(yencode par2-turbo)
add_dependencies(regex par2-turbo)

set(FUNCTION_MACRO_NAME __FUNCTION__)
set(HAVE_CTIME_R_3 1)
set(HAVE_VARIADIC_MACROS 1)
Expand Down
3 changes: 3 additions & 0 deletions daemon/main/nzbget.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@
#include <libxml/tree.h>

#include <boost/asio.hpp>
#if !defined(DISABLE_TLS) && defined(HAVE_OPENSSL)
#include <boost/asio/ssl.hpp>
#endif

// NOTE: do not include <iostream> in "nzbget.h". <iostream> contains objects requiring
// intialization, causing every unit in nzbget to have initialization routine. This in particular
Expand Down
10 changes: 5 additions & 5 deletions lib/sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "i?86|x86_64")
set(SSE2_CXXFLAGS "-msse2")
set(SSSE3_CXXFLAGS "-mssse3")
set(PCLMUL_CXXFLAGS "-msse4.1 -mpclmul")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm.*")
set(NEON_CXXFLAGS "-mfpu=neon")
set(ACLECRC_CXXFLAGS "-march=armv8-a+crc -fpermissive")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(ACLECRC_CXXFLAGS "-march=armv8-a+crc -fpermissive")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
set(ACLECRC_CXXFLAGS "-march=armv8-a+crc -fpermissive")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm.*")
set(NEON_CXXFLAGS "-mfpu=neon")
set(ACLECRC_CXXFLAGS "-march=armv8-a+crc -fpermissive")
endif()

add_library(regex STATIC
Expand Down
1 change: 1 addition & 0 deletions lib/yencode/SimdDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "nzbget.h"

#ifdef SIMD_DECODER

Expand Down
3 changes: 2 additions & 1 deletion linux/build-nzbget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ build_bin()
export LDFLAGS=""
export NZBGET_INCLUDES="$TOOLCHAIN_PATH/$ARCH/output/staging/usr/include/;"

if [ $PLATFORM == "freebsd" ]; then
if [ "$PLATFORM" == "freebsd" ]; then
export CXXFLAGS="-Os --sysroot=$FREEBSD_SYSROOT -I$FREEBSD_SYSROOT/usr/include/c++/v1"
export CFLAGS=$CXXFLAGS
export CPPFLAGS=$CXXFLAGS
Expand Down Expand Up @@ -649,6 +649,7 @@ build_bin()
;;
esac

unset CFLAGS
unset CXXFLAGS
unset CPPFLAGS
unset LDFLAGS
Expand Down
1 change: 1 addition & 0 deletions osx/build-nzbget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ for ARCH in $ARCHS; do
cmake ../.. \
-DENABLE_STATIC=ON \
-DCMAKE_INSTALL_PREFIX="$PWD/../../$NZBGET_PATH/$DAEMON_PATH" \
-DCMAKE_SYSTEM_NAME="Darwin" \
-DVERSION_SUFFIX="$VERSION_SUFFIX" \
-DCMAKE_SYSTEM_PROCESSOR=$CMAKE_ARCH \
-DCMAKE_OSX_ARCHITECTURES=$CMAKE_ARCH
Expand Down
2 changes: 1 addition & 1 deletion tests/extension/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file(GLOB ExtensionSrc
set(ExtensionSrc
main.cpp
ManifestFileTest.cpp
ExtensionLoaderTest.cpp
Expand Down
2 changes: 1 addition & 1 deletion tests/postprocess/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file(GLOB PostprocessTestsSrc
set(PostprocessTestsSrc
main.cpp
# DirectUnpackTest.cpp
# DupeMatcherTest.cpp
Expand Down
3 changes: 1 addition & 2 deletions tests/system/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file(GLOB SystemTestsSrc
set(SystemTestsSrc
main.cpp
SystemInfoTest.cpp
${CMAKE_SOURCE_DIR}/daemon/system/CPU.cpp
Expand All @@ -7,7 +7,6 @@ file(GLOB SystemTestsSrc
${CMAKE_SOURCE_DIR}/daemon/system/SystemInfo.cpp
${CMAKE_SOURCE_DIR}/daemon/connect/HttpClient.cpp
${CMAKE_SOURCE_DIR}/daemon/main/Options.cpp
${CMAKE_SOURCE_DIR}/daemon/remote/MessageBase.cpp
${CMAKE_SOURCE_DIR}/daemon/queue/DownloadInfo.cpp
${CMAKE_SOURCE_DIR}/daemon/queue/DiskState.cpp
${CMAKE_SOURCE_DIR}/daemon/feed/FeedInfo.cpp
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/util/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file(GLOB UtilTestSrc
set(UtilTestSrc
main.cpp
FileSystemTest.cpp
UtilTest.cpp
Expand Down