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

Updates for compilation on Ubuntu 24 #78

Merged
merged 9 commits into from
Dec 20, 2024
9 changes: 6 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ jobs:
steps:
- name: Install clang-format
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
CODENAME=$(lsb_release --short --codename)
sudo add-apt-repository "deb https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${CLANG_VERSION} main"
major_version=$(lsb_release -rs | cut -d'.' -f1)
if [ "$major_version" -lt "24" ]; then
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
CODENAME=$(lsb_release --short --codename)
sudo add-apt-repository "deb https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${CLANG_VERSION} main"
fi
sudo apt update
sudo apt install -y clang-format-${CLANG_VERSION}

Expand Down
26 changes: 23 additions & 3 deletions .github/workflows/ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,47 @@ jobs:
fail-fast: false
matrix:
include:
- name: Build - Ubuntu 20 Clang
runs-on: ubuntu-20.04
compiler: clang
cxx-compiler: clang++
cmake-args: -G Ninja -D PROXYRES_CODE_COVERAGE=ON
packages: llvm-12 libjavascriptcoregtk-4.0-dev libgconf2-dev
gcov-exec: llvm-cov-12 gcov
codecov: ubuntu

- name: Build - Ubuntu 22 Clang
runs-on: ubuntu-22.04
compiler: clang
cxx-compiler: clang++
cmake-args: -G Ninja -D PROXYRES_CODE_COVERAGE=ON
packages: llvm-14 libjavascriptcoregtk-4.0-dev libgconf2-dev
gcov-exec: llvm-cov-14 gcov
codecov: ubuntu

- name: Build - Ubuntu Clang
runs-on: ubuntu-latest
compiler: clang
cxx-compiler: clang++
cmake-args: -G Ninja -D PROXYRES_CODE_COVERAGE=ON
gcov-exec: llvm-cov-14 gcov
packages: llvm-15 libjavascriptcoregtk-4.1-dev gsettings-desktop-schemas
gcov-exec: llvm-cov-15 gcov
codecov: ubuntu

- name: Build - Ubuntu Clang (curl)
runs-on: ubuntu-latest
compiler: clang
cxx-compiler: clang++
cmake-args: -G Ninja -D PROXYRES_CODE_COVERAGE=ON -D PROXYRES_CURL=ON
gcov-exec: llvm-cov-14 gcov
packages: llvm-15 libjavascriptcoregtk-4.1-dev gsettings-desktop-schemas
gcov-exec: llvm-cov-15 gcov
codecov: ubuntu_curl

steps:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y llvm-14 ninja-build libgconf2-dev libjavascriptcoregtk-4.0-dev
sudo apt install -y ninja-build libpsl-dev ${{ matrix.packages }}

- name: Checkout repository
uses: actions/checkout@v4
Expand Down
19 changes: 11 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,14 @@ elseif(APPLE)
wpad_dhcp_mac.h)
endif()
elseif(UNIX)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GConf gconf-2.0)
if (GConf_FOUND)
list(APPEND PROXYRES_SRCS config_gnome2.c config_gnome2.h)
endif()
list(APPEND PROXYRES_SRCS
config_env.c
config_env.h
config_gnome2.c
config_gnome2.h
config_gnome3.c
config_gnome3.h
config_kde.c
Expand Down Expand Up @@ -282,16 +285,16 @@ elseif(APPLE)

set_target_properties(proxyres PROPERTIES LINK_FLAGS -Wl,-F/Library/Frameworks)
elseif(UNIX)
find_package(PkgConfig REQUIRED)

pkg_check_modules(deps REQUIRED IMPORTED_TARGET glib-2.0)
target_link_libraries(proxyres PkgConfig::deps)

pkg_check_modules(GConf REQUIRED gconf-2.0)
# Don't link libraries at compile time since we dynamically load them at runtime
target_include_directories(proxyres PRIVATE ${GConf_INCLUDE_DIRS})
if (GConf_FOUND)
# Don't link libraries at compile time since we dynamically load them at runtime
target_include_directories(proxyres PRIVATE ${GConf_INCLUDE_DIRS})
target_compile_definitions(proxyres PRIVATE HAVE_GCONF)
endif()

pkg_search_module(JSCoreGTK REQUIRED javascriptcoregtk-4.0 javascriptcoregtk-3.0 javascriptcoregtk-1.0)
pkg_search_module(JSCoreGTK REQUIRED javascriptcoregtk-4.1 javascriptcoregtk-4.0 javascriptcoregtk-3.0 javascriptcoregtk-1.0)
# Don't link libraries at compile time since we dynamically load them at runtime
target_include_directories(proxyres PRIVATE ${JSCoreGTK_INCLUDE_DIRS})

Expand Down
6 changes: 5 additions & 1 deletion config.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#if defined(__APPLE__)
# include "config_mac.h"
#elif defined(__linux__)
# include "config_gnome2.h"
# ifdef HAVE_GCONF
# include "config_gnome2.h"
# endif
# include "config_gnome3.h"
# include "config_kde.h"
#elif defined(_WIN32)
Expand Down Expand Up @@ -102,10 +104,12 @@ bool proxy_config_global_init(void) {
if (proxy_config_gnome3_global_init())
g_proxy_config.proxy_config_i = proxy_config_gnome3_get_interface();
break;
# ifdef HAVE_GCONF
case DESKTOP_ENV_GNOME2:
if (proxy_config_gnome2_global_init())
g_proxy_config.proxy_config_i = proxy_config_gnome2_get_interface();
break;
# endif
case DESKTOP_ENV_KDE5:
case DESKTOP_ENV_KDE4:
case DESKTOP_ENV_KDE3:
Expand Down
1 change: 0 additions & 1 deletion config_gnome3.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <dlfcn.h>
#include <glib.h>
#include <gio/gio.h>
#include <gconf/gconf.h>

#include "config.h"
#include "config_i.h"
Expand Down
1 change: 1 addition & 0 deletions test/curl_proxyres.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

#ifdef _WIN32
Expand Down
Loading