From 368de524499220fe8f1178282d39bdbae1ccd21e Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Mon, 8 Oct 2018 22:22:44 +0900 Subject: [PATCH 01/19] Meson: Add support for Meson build system Meson doesn't need intltool and instead relies on recent version of gettext. Some existing files for intltool (*.appdata.xml.in and *.desktop.in) are incompatible with gettext and we need another set of them. --- .travis.yml | 145 +++++++++-- Makefile.am | 17 +- appveyor.yml | 60 ++++- data/apparmor/meson.build | 10 + data/appdata/meson.build | 11 + .../appdata/meson_redshift-gtk.appdata.xml.in | 20 ++ data/applications/meson.build | 23 ++ .../meson_redshift-gtk.desktop.in | 12 + data/applications/meson_redshift.desktop.in | 12 + data/meson.build | 14 + data/systemd/meson.build | 16 ++ meson.build | 244 ++++++++++++++++++ meson_options.txt | 72 ++++++ po/meson.build | 5 + po/meson_gen_potfiles.py | 19 ++ src/Makefile.am | 2 +- src/meson.build | 98 +++++++ src/redshift-gtk/Makefile.am | 2 +- src/redshift-gtk/meson.build | 29 +++ src/redshift-gtk/meson_compile_py.py | 7 + 20 files changed, 784 insertions(+), 34 deletions(-) create mode 100644 data/apparmor/meson.build create mode 100644 data/appdata/meson.build create mode 100644 data/appdata/meson_redshift-gtk.appdata.xml.in create mode 100644 data/applications/meson.build create mode 100644 data/applications/meson_redshift-gtk.desktop.in create mode 100644 data/applications/meson_redshift.desktop.in create mode 100644 data/meson.build create mode 100644 data/systemd/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 po/meson.build create mode 100755 po/meson_gen_potfiles.py create mode 100644 src/meson.build create mode 100644 src/redshift-gtk/meson.build create mode 100755 src/redshift-gtk/meson_compile_py.py diff --git a/.travis.yml b/.travis.yml index cc0d35d3..8fd075bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,26 @@ language: c +sudo: required + matrix: include: - os: linux compiler: gcc - dist: trusty - sudo: false + env: USE_MESON=0 + - os: linux + compiler: gcc + env: USE_MESON=1 + - os: osx + compiler: clang + env: USE_MESON=0 - os: osx compiler: clang + env: USE_MESON=1 addons: apt: packages: - - autopoint - - intltool # DRM - libdrm-dev # RANDR @@ -25,30 +31,127 @@ addons: - libxxf86vm-dev # GeoClue2 - libglib2.0-dev - # GUI - - python3 - -before_install: | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then - brew update - brew install gettext - brew link --force gettext - brew install intltool - fi install: - - ./bootstrap - - mkdir "$TRAVIS_BUILD_DIR/root" + - | + if [ "$TRAVIS_OS_NAME" == "osx" ]; then + # Note: "brew update" and "brew install gettext" are not necessary and + # we can install needed packages with HOMEBREW_NO_AUTO_UPDATE=1. + # This reduces job time significantly. + brew update + brew install gettext + brew link --force gettext + if [ "$USE_MESON" -eq "1" ]; then + # Building with Meson sometimes fails due to its regressions. + # Meson can be installed via brew, but + # we install it via pip to pin its version. + # Meson uses Ninja and we install it via brew. + brew install ninja + else + brew install intltool + + # distuninstallcheck fails on macOS when automake 1.16 or 1.16.1 is used. + # http://gnu-automake.7480.n7.nabble.com/bug-31222-automake-1-16-1-am-pep3147-tweak-bug-td22937.html + # No upstream release yet, use upstream patch. + pushd /usr/local/Cellar/automake/*/share/automake-* + curl "https://git.savannah.gnu.org/cgit/automake.git/patch/?id=a348d830659fffd2cfc42994524783b07e69b4b5" | tail -n 14 | sudo patch -p2 + popd + fi + # Note: No longer needed. + brew upgrade python + fi + - | + if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$USE_MESON" -eq "0" ]; then + sudo apt-get install autopoint intltool + fi + - | + if [ "$TRAVIS_OS_NAME" == "linux" ]; then + if [ "$USE_MESON" -eq "1" ]; then + # We need to use newer versions of Ninja and gettext to + # get Meson to work on Ubuntu 14.04 LTS (Trusty). + + # Ninja: From official GitHub repo, smaller than other versions + ninja_url=https://github.com/ninja-build/ninja/releases/download/v1.5.3/ninja-linux.zip + wget -O - "$ninja_url" | funzip > ninja + sudo install -m 755 ninja /usr/bin + + # gettext and its dependencies: From Ubuntu 18.04 LTS (Bionic) mirror + # * Only msgfmt and xgettext need to be upgraded to 0.19.7+. + # * appdata.{its,loc} are needed too. + gettext_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/g/gettext/gettext_0.19.8.1-6_amd64.deb + libtinfo_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1_amd64.deb + libunistring_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/libu/libunistring/libunistring2_0.9.9-0ubuntu1_amd64.deb + for url in "$gettext_url" "$libtinfo_url" "$libunistring_url"; do + wget "$url" + done + ar p gettext*.deb data.tar.xz > gettext.tar.xz + ar p libtinfo*.deb data.tar.xz > libtinfo.tar.xz + ar p libunistring*.deb data.tar.xz > libunistring.tar.xz + cmd="tar -C / -Jxf gettext.tar.xz" + cmd="$cmd ./usr/bin/msgfmt" + cmd="$cmd ./usr/bin/xgettext" + cmd="$cmd ./usr/lib/x86_64-linux-gnu/libgettext{lib,src}{,-0.19.8.1}.so" + cmd="$cmd ./usr/share/gettext-0.19.8/its/appdata.{its,loc} &&" + cmd="$cmd tar -C / -Jxf libtinfo.tar.xz" + cmd="$cmd ./lib/x86_64-linux-gnu/libtinfo.so.5{.9,} &&" + cmd="$cmd tar -C / -Jxf libunistring.tar.xz" + cmd="$cmd ./usr/lib/x86_64-linux-gnu/libunistring.so.2{.1.0,}" + sudo bash -c "$cmd" + + # Set PATH to use Python 3.6 and Meson + # Note: Python 3.6 is available without additional download. + export PATH=~/virtualenv/python3.6/bin:~/.local/bin:$PATH + fi + fi + # Note: Meson 0.48.0 prints target name related warnings. + # (already fixed upstream but no release yet) + - if [ "$USE_MESON" -eq "1" ]; then pip3 install meson==0.47.2; fi + +before_script: - | if [ "$TRAVIS_OS_NAME" == "linux" ]; then - ./configure --prefix="$TRAVIS_BUILD_DIR/root" --enable-drm --enable-vidmode --enable-randr --enable-geoclue2 --enable-gui --enable-apparmor - elif [ "$TRAVIS_OS_NAME" == "osx" ]; then - ./configure --prefix="$TRAVIS_BUILD_DIR/root" --enable-corelocation --enable-quartz --enable-gui + CONF_FLAGS="--prefix=$TRAVIS_BUILD_DIR/root" + if [ "$USE_MESON" -eq "1" ]; then + CONF_FLAGS="$CONF_FLAGS -Ddrm=enabled -Drandr=enabled" + CONF_FLAGS="$CONF_FLAGS -Dvidmode=enabled -Dquartz=disabled" + CONF_FLAGS="$CONF_FLAGS -Dwingdi=disabled -Dgeoclue2=enabled" + CONF_FLAGS="$CONF_FLAGS -Dcorelocation=disabled -Dgui=enabled" + CONF_FLAGS="$CONF_FLAGS -Dubuntu=disabled -Dapparmor=enabled" + else + CONF_FLAGS="$CONF_FLAGS --enable-drm --enable-vidmode --enable-randr" + CONF_FLAGS="$CONF_FLAGS --enable-geoclue2 --enable-gui --enable-apparmor" + fi + export CONF_FLAGS + fi + - | + if [ "$TRAVIS_OS_NAME" == "osx" ]; then + CONF_FLAGS="--prefix=$TRAVIS_BUILD_DIR/root" + if [ "$USE_MESON" -eq "1" ]; then + CONF_FLAGS="$CONF_FLAGS -Ddrm=disabled -Drandr=disabled" + CONF_FLAGS="$CONF_FLAGS -Dvidmode=disabled -Dquartz=enabled" + CONF_FLAGS="$CONF_FLAGS -Dwingdi=disabled -Dgeoclue2=disabled" + CONF_FLAGS="$CONF_FLAGS -Dcorelocation=enabled -Dgui=disabled" + CONF_FLAGS="$CONF_FLAGS -Dubuntu=disabled -Dapparmor=disabled" + else + CONF_FLAGS="$CONF_FLAGS --enable-corelocation --enable-quartz" + fi + export CONF_FLAGS fi - - make -j2 install - - make -j2 distcheck script: + # Build with Meson + - if [ "$USE_MESON" -eq "1" ]; then meson $CONF_FLAGS _build; fi + - if [ "$USE_MESON" -eq "1" ]; then ninja -v -C _build install; fi + # Note: "test" and "dist" fail with Meson 0.48.0. + # (already fixed upstream, will be fixed in next release) + - if [ "$USE_MESON" -eq "1" ]; then ninja -v -C _build test; fi + - if [ "$USE_MESON" -eq "1" ]; then ninja -v -C _build dist; fi + # Build with autotools-based build system + - if [ "$USE_MESON" -eq "0" ]; then ./bootstrap; fi + - if [ "$USE_MESON" -eq "0" ]; then ./configure $CONF_FLAGS; fi + - if [ "$USE_MESON" -eq "0" ]; then make -j2 install; fi + - if [ "$USE_MESON" -eq "0" ]; then make -j2 distcheck; fi + # redshift tests - | "$TRAVIS_BUILD_DIR"/root/bin/redshift -l 12:-34 -pv - | diff --git a/Makefile.am b/Makefile.am index 7e58f082..a3b1bbb7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,6 +42,20 @@ APPDATA_IN_FILES = \ APPARMOR_IN_FILES = \ data/apparmor/usr.bin.redshift.in +MESON_FILES = \ + meson_options.txt \ + meson.build \ + po/meson.build \ + po/meson_gen_potfiles.py \ + data/meson.build \ + data/apparmor/meson.build \ + data/appdata/meson.build \ + data/appdata/meson_redshift-gtk.appdata.xml.in \ + data/applications/meson.build \ + data/applications/meson_redshift-gtk.desktop.in \ + data/applications/meson_redshift.desktop.in \ + data/systemd/meson.build + # Icons if ENABLE_GUI @@ -126,7 +140,8 @@ EXTRA_DIST = \ $(DESKTOP_IN_FILES) \ $(SYSTEMD_USER_UNIT_IN_FILES) \ $(APPDATA_IN_FILES) \ - $(APPARMOR_IN_FILES) + $(APPARMOR_IN_FILES) \ + $(MESON_FILES) CLEANFILES = \ $(desktop_DATA) \ diff --git a/appveyor.yml b/appveyor.yml index 0ac39835..08a68319 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,27 +3,67 @@ image: environment: matrix: + # MSYS2 + mingw-w64 - arch: x86_64 + use_meson: 0 + MSYSTEM: MINGW64 + PATH: C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%; - arch: i686 + use_meson: 0 + MSYSTEM: MINGW32 + PATH: C:\msys64\mingw32\bin;C:\msys64\usr\bin;%PATH%; + # Meson + mingw-w64 + - arch: x86_64 + use_meson: 1 + PATH: C:\Python37;C:\Python37\scripts;C:\msys64\mingw64\bin;%PATH%; + - arch: i686 + use_meson: 1 + PATH: C:\Python37;C:\Python37\scripts;C:\msys64\mingw32\bin;%PATH%; build: verbosity: detailed -build_script: +install: - ps: | - If ($env:arch -Match "x86_64") { - $env:MSYSTEM = "MINGW64" - } Else { - $env:MSYSTEM = "MINGW32" + if ($env:use_meson -eq "1") { + Start-FileDownload "https://raw.githubusercontent.com/mesonbuild/cidata/e5ea5b021d8144515a1b8f576cda327e45a81235/ninja.exe" } + # Use working versions of Meson +- if "%use_meson%" == "1" ( pip3 install meson==0.47.2 ) + +before_build: +- ps: | + if ($env:use_meson -eq "1") { + $env:CONF_FLAGS = "--prefix=${env:APPVEYOR_BUILD_FOLDER}\root" + $env:CONF_FLAGS += " -Ddrm=disabled -Drandr=disabled -Dvidmode=disabled" + $env:CONF_FLAGS += " -Dwingdi=enabled -Dquartz=disabled" + $env:CONF_FLAGS += " -Dgeoclue2=disabled -Dcorelocation=disabled" + $env:CONF_FLAGS += " -Dgui=disabled -Dubuntu=disabled -Dnls=disabled" + + # For Ninja + $env:PATH = "${env:APPVEYOR_BUILD_FOLDER};${env:PATH};" + } else { + $env:CONF_FLAGS = "--host=${env:arch}-w64-mingw32" + $env:CONF_FLAGS += " --disable-drm --disable-randr --disable-vidmode" + $env:CONF_FLAGS += " --enable-wingdi --disable-quartz --disable-geoclue2" + $env:CONF_FLAGS += " --disable-corelocation --disable-gui" + $env:CONF_FLAGS += " --disable-ubuntu --disable-nls" - $env:CONFIGURE_FLAGS = "--disable-drm --disable-randr --disable-vidmode --enable-wingdi --disable-quartz --disable-geoclue2 --disable-corelocation --disable-gui --disable-ubuntu --disable-nls --host=$env:arch-w64-mingw32" + # For MSYS2 + $env:HOME = $env:APPVEYOR_BUILD_FOLDER + } +build_script: - ps: md (Join-Path $env:APPVEYOR_BUILD_FOLDER root) -- C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./bootstrap" -- C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./configure --prefix=\"$APPVEYOR_BUILD_FOLDER/root\" $CONFIGURE_FLAGS" -- C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER && make distcheck DISTCHECK_CONFIGURE_FLAGS=\"$CONFIGURE_FLAGS\"" -- C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER && make install" +- if "%use_meson%" == "1" ( meson %CONF_FLAGS% _build && + ninja -C _build install && + ninja -C _build test && + ninja -C _build dist ) +- if "%use_meson%" == "0" ( + bash -lc "./bootstrap" && + bash -lc "./configure --prefix=\"$APPVEYOR_BUILD_FOLDER/root\" $CONF_FLAGS" && + bash -lc "make install" && + bash -lc "make distcheck DISTCHECK_CONFIGURE_FLAGS=\"$CONF_FLAGS\"" ) test_script: - | diff --git a/data/apparmor/meson.build b/data/apparmor/meson.build new file mode 100644 index 00000000..84f2ea32 --- /dev/null +++ b/data/apparmor/meson.build @@ -0,0 +1,10 @@ +if config_build.has('ENABLE_APPARMOR') + usr_bin_redshift = configure_file( + input : 'usr.bin.redshift.in', + output : 'usr.bin.redshift', + configuration : in_substs, + ) + install_data(usr_bin_redshift, + install_dir : join_paths(get_option('sysconfdir'), 'apparmor.d'), + ) +endif diff --git a/data/appdata/meson.build b/data/appdata/meson.build new file mode 100644 index 00000000..73612837 --- /dev/null +++ b/data/appdata/meson.build @@ -0,0 +1,11 @@ +if host_machine.system() != 'windows' + if config_build.has('ENABLE_GUI') + i18n.merge_file( + input : 'meson_redshift-gtk.appdata.xml.in', + output : 'redshift-gtk.appdata.xml', + po_dir : po_dir, + install : true, + install_dir : join_paths(get_option('datadir'), 'appdata'), + ) + endif +endif diff --git a/data/appdata/meson_redshift-gtk.appdata.xml.in b/data/appdata/meson_redshift-gtk.appdata.xml.in new file mode 100644 index 00000000..daecb25e --- /dev/null +++ b/data/appdata/meson_redshift-gtk.appdata.xml.in @@ -0,0 +1,20 @@ + + + + redshift-gtk.desktop + CC0 + GPL-3.0+ + +

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.

+

The color temperature is set according to the position of the sun. A different color temperature is set during night and daytime. During twilight and early morning, the color temperature transitions smoothly from night to daytime temperature to allow your eyes to slowly adapt.

+

This program provides a status icon that allows the user to control Redshift.

+
+ + + http://jonls.dk/assets/screenshot1.png + The Redshift information window overlaid with an example of the redness effect + + + http://jonls.dk/redshift/ + jonlst@gmail.com +
diff --git a/data/applications/meson.build b/data/applications/meson.build new file mode 100644 index 00000000..32ae28d5 --- /dev/null +++ b/data/applications/meson.build @@ -0,0 +1,23 @@ +if host_machine.system() != 'windows' + desktop_dir = join_paths(get_option('datadir'), 'applications') + + i18n.merge_file( + input : 'meson_redshift.desktop.in', + output : 'redshift.desktop', + type : 'desktop', + po_dir : po_dir, + install : true, + install_dir : desktop_dir, + ) + + if config_build.has('ENABLE_GUI') + i18n.merge_file( + input : 'meson_redshift-gtk.desktop.in', + output : 'redshift-gtk.desktop', + type : 'desktop', + po_dir : po_dir, + install : true, + install_dir : desktop_dir, + ) + endif +endif diff --git a/data/applications/meson_redshift-gtk.desktop.in b/data/applications/meson_redshift-gtk.desktop.in new file mode 100644 index 00000000..ed6a3d05 --- /dev/null +++ b/data/applications/meson_redshift-gtk.desktop.in @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +Name=Redshift +GenericName=Color temperature adjustment +Comment=Color temperature adjustment tool +Exec=redshift-gtk +# TRANSLATORS: Icon name, please set to "redshift" +Icon=redshift +Terminal=false +Type=Application +Categories=Utility; +StartupNotify=true diff --git a/data/applications/meson_redshift.desktop.in b/data/applications/meson_redshift.desktop.in new file mode 100644 index 00000000..c7a28e5c --- /dev/null +++ b/data/applications/meson_redshift.desktop.in @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +Name=Redshift +GenericName=Color temperature adjustment +Comment=Color temperature adjustment tool +Exec=redshift +# TRANSLATORS: Icon name, please set to "redshift" +Icon=redshift +Terminal=true +Type=Application +Categories=Utility; +NoDisplay=true diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 00000000..02f14f6d --- /dev/null +++ b/data/meson.build @@ -0,0 +1,14 @@ +# Icons +icons_dir = join_paths(get_option('datadir'), 'icons') +install_subdir(join_paths('icons', 'hicolor'), install_dir : icons_dir) +if config_build.has('ENABLE_UBUNTU') + install_subdir( + join_paths('icons', 'ubuntu-mono-dark'), install_dir : icons_dir) + install_subdir( + join_paths('icons', 'ubuntu-mono-light'), install_dir : icons_dir) +endif + +subdir('apparmor') +subdir('appdata') +subdir('applications') +subdir('systemd') diff --git a/data/systemd/meson.build b/data/systemd/meson.build new file mode 100644 index 00000000..5fb421e0 --- /dev/null +++ b/data/systemd/meson.build @@ -0,0 +1,16 @@ +if config_build.has('ENABLE_SYSTEMD') + redshift_service = configure_file( + input : 'redshift.service.in', + output : 'redshift.service', + configuration : in_substs, + ) + install_data(redshift_service, install_dir : systemd_userunitdir) + if config_build.has('ENABLE_GUI') + redshift_gtk_service = configure_file( + input : 'redshift-gtk.service.in', + output : 'redshift-gtk.service', + configuration : in_substs, + ) + install_data(redshift_gtk_service, install_dir : systemd_userunitdir) + endif +endif diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..c85aa77a --- /dev/null +++ b/meson.build @@ -0,0 +1,244 @@ +project( + 'redshift', + 'c', + default_options : ['buildtype=debugoptimized', 'c_std=gnu99'], + license : 'GPL3+', + meson_version : '>= 0.47', + version : '1.12', +) +proj_name = meson.project_name() +proj_version = meson.project_version() +proj_bugreport = 'https://github.com/jonls/redshift/issues' + +# TODO: Currently unity build fails due to redefinition error. +# (hooks.c and redshift.c have "static" variable "period_names") +if meson.is_unity() + error('Sorry, unity build is currently broken.') +endif + +cc = meson.get_compiler('c') + +# Directories +full_bindir = join_paths(get_option('prefix'), get_option('bindir')) +full_localedir = join_paths(get_option('prefix'), get_option('localedir')) +po_dir = join_paths(meson.source_root(), 'po') +in_substs = configuration_data() +in_substs.set('bindir', full_bindir) +in_substs.set('localedir', full_localedir) + +# config.h +configuration_inc = include_directories('.') +add_project_arguments('-DHAVE_CONFIG_H', language : ['c', 'objc']) +config_h = configuration_data() +config_h.set_quoted('GETTEXT_PACKAGE', proj_name) +config_h.set_quoted('PACKAGE', proj_name) +config_h.set_quoted('PACKAGE_BUGREPORT', proj_bugreport) +config_h.set_quoted('PACKAGE_NAME', proj_name) +config_h.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(proj_name, proj_version)) +config_h.set_quoted('PACKAGE_TARNAME', proj_name) +config_h.set_quoted('PACKAGE_VERSION', proj_version) +config_h.set_quoted('LOCALEDIR', full_localedir) + +# Check for library functions +intl_dep = cc.find_library('intl', required : false) +m_dep = cc.find_library('m', required : false) +if cc.sizeof('uint16_t', prefix : '#include ') == -1 + error('uint16_t is not defined.') +endif +foreach f : ['setlocale', 'strchr', 'floor', 'pow'] + if not cc.has_function(f, dependencies : m_dep) + error('Function "@0@" is not available.'.format(f)) + endif +endforeach + +# NLS +opt_nls = get_option('nls') +if not opt_nls.disabled() + have_gettext_func = cc.has_function('gettext', dependencies : intl_dep) + if not have_gettext_func and opt_nls.enabled() + error('Function gettext() is not available.') + endif + have_libintl_h = cc.has_header('libintl.h') + if not have_libintl_h and opt_nls.enabled() + error('libintl.h is not installed.') + endif + if have_gettext_func and have_libintl_h + config_h.set('ENABLE_NLS', 1) + endif +endif + +# Check for header files +system_headers = [ + 'locale.h', + 'signal.h', + 'stdint.h', + 'stdlib.h', + 'string.h', + 'unistd.h', +] +foreach h : system_headers + if cc.has_header(h) + config_h.set('HAVE_@0@'.format(h.to_upper().underscorify()), 1) + endif +endforeach + +# Build configuration +config_build = configuration_data() + +null_dep = disabler() + +# Check DRM method +drm_dep = dependency('libdrm', required : get_option('drm')) +if drm_dep.found() + config_h.set('ENABLE_DRM', 1) +endif + +# Check RANDR method +xcb_dep = null_dep +xcb_randr_dep = dependency('xcb-randr', required : get_option('randr')) +if xcb_randr_dep.found() + xcb_dep = dependency('xcb') +endif +if xcb_dep.found() + config_h.set('ENABLE_RANDR', 1) +endif + +# Check VidMode method +x11_dep = null_dep +xxf86vm_dep = dependency('xxf86vm', required : get_option('vidmode')) +if xxf86vm_dep.found() + x11_dep = dependency('x11') +endif +if x11_dep.found() + config_h.set('ENABLE_VIDMODE', 1) +endif + +# Check Quartz (macOS) method +appservices_dep = dependency('appleframeworks', + modules : 'applicationservices', required : get_option('quartz')) +if appservices_dep.found() and cc.has_header( + 'ApplicationServices/ApplicationServices.h') + config_h.set('ENABLE_QUARTZ', 1) +endif + +# Check Windows GDI method +gdi32_dep = cc.find_library('gdi32', required : get_option('wingdi')) +if gdi32_dep.found() and cc.has_header('windows.h') + config_h.set('ENABLE_WINGDI', 1) +endif + +# Check Geoclue2 location provider +gio_dep = dependency( + 'gio-2.0', version : '>= 2.26', required : get_option('geoclue2')) +if gio_dep.found() + config_h.set('ENABLE_GEOCLUE2', 1) +endif + +# Check CoreLocation (macOS) provider +foundation_dep = null_dep +cocoa_dep = null_dep +corelocation_dep = dependency('appleframeworks', + modules : 'corelocation', required : get_option('corelocation')) +if corelocation_dep.found() + foundation_dep = dependency('appleframeworks', modules : 'foundation') + cocoa_dep = dependency('appleframeworks', modules : 'cocoa') +endif +if foundation_dep.found() and cocoa_dep.found() + add_languages('objc') + objc = meson.get_compiler('objc') + if objc.has_header('CoreLocation/CoreLocation.h') + config_h.set('ENABLE_CORELOCATION', 1) + endif +endif + +# Check for GUI status icon +# TODO: Pass "get_option('gui')" to "required" kwarg +# and set meson_version in project() to ">= 0.48". +# Note that there are some regressions in 0.48.0 and +# we currently cannot switch to 0.48.0. See .travis.yml. +pymod = import('python') +opt_gui = get_option('gui') +if not opt_gui.disabled() + py_installation = pymod.find_installation( + 'python3', required : opt_gui.enabled()) + if py_installation.found() + config_build.set('ENABLE_GUI', 1) + endif +endif + +# Check for Ubuntu icons +if get_option('ubuntu').enabled() + config_build.set('ENABLE_UBUNTU', 1) +endif + +# Check for systemd +systemd_userunitdir = '' +opt_systemd_userunitdir = get_option('systemduserunitdir') +if opt_systemd_userunitdir != 'disabled' + if opt_systemd_userunitdir == 'auto' + if host_machine.system() == 'linux' + pkgconfig = find_program('pkg-config', required : false) + if pkgconfig.found() + cmd = run_command(pkgconfig, '--variable=systemduserunitdir', 'systemd') + if cmd.returncode() == 0 + systemd_userunitdir = cmd.stdout().strip() + config_build.set('ENABLE_SYSTEMD', 1) + endif + endif + endif + else + systemd_userunitdir = opt_systemd_userunitdir + config_build.set('ENABLE_SYSTEMD', 1) + endif +endif + +# Check for AppArmor +if get_option('apparmor').enabled() + config_build.set('ENABLE_APPARMOR', 1) +endif + +# i18n (used in subdirs) +i18n = import('i18n') + +# Man +install_man('redshift.1') + +# Subdirectories +subdir('src') +subdir('po') +subdir('data') + +# Generate config.h +configure_file(output : 'config.h', configuration : config_h) + +message('''@0@ @1@ + prefix: @2@ + + Adjustment methods: + DRM: @3@ + RANDR: @4@ + VidMode: @5@ + Quartz (macOS): @6@ + WinGDI (Windows): @7@ + + Location providers: + Geoclue2: @8@ + CoreLocation (macOS): @9@ + + GUI: @10@ + Ubuntu icons: @11@ + systemd units: @12@ @13@ + AppArmor profile: @14@ +'''.format(proj_name, proj_version, get_option('prefix'), + config_h.has('ENABLE_DRM') ? 'yes' : 'no', + config_h.has('ENABLE_RANDR') ? 'yes' : 'no', + config_h.has('ENABLE_VIDMODE') ? 'yes' : 'no', + config_h.has('ENABLE_QUARTZ') ? 'yes' : 'no', + config_h.has('ENABLE_WINGDI') ? 'yes' : 'no', + config_h.has('ENABLE_GEOCLUE2') ? 'yes' : 'no', + config_h.has('ENABLE_CORELOCATION') ? 'yes' : 'no', + config_build.has('ENABLE_GUI') ? 'yes' : 'no', + config_build.has('ENABLE_UBUNTU') ? 'yes' : 'no', + config_build.has('ENABLE_SYSTEMD') ? 'yes' : 'no', systemd_userunitdir, + config_build.has('ENABLE_APPARMOR') ? 'yes' : 'no', +)) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..17ca79ed --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,72 @@ +option( + 'nls', + type : 'feature', + value : 'auto', + description : 'NLS support' +) +option( + 'drm', + type : 'feature', + value : 'auto', + description : 'DRM method' +) +option( + 'randr', + type : 'feature', + value : 'auto', + description : 'RANDR method' +) +option( + 'vidmode', + type : 'feature', + value : 'auto', + description : 'VidMode method' +) +option( + 'quartz', + type : 'feature', + value : 'auto', + description : 'Quartz (macOS) method' +) +option( + 'wingdi', + type : 'feature', + value : 'auto', + description : 'WinGDI method' +) +option( + 'corelocation', + type : 'feature', + value : 'auto', + description : 'CoreLocation (macOS) provider' +) +option( + 'geoclue2', + type : 'feature', + value : 'auto', + description : 'Geoclue2 provider' +) +option( + 'gui', + type : 'feature', + value : 'auto', + description : 'GUI status icon' +) +option( + 'ubuntu', + type : 'feature', + value : 'disabled', + description : 'Ubuntu icons' +) +option( + 'apparmor', + type : 'feature', + value : 'disabled', + description : 'AppArmor profile' +) +option( + 'systemduserunitdir', + type : 'string', + value : 'auto', + description : 'Directory for systemd user unit files (or, "auto" / "disabled")' +) diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 00000000..c6bf7353 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,5 @@ +# TODO: Remove the script when dropping autotools-based build system +# in the future. +meson.add_postconf_script('meson_gen_potfiles.py') + +i18n.gettext(proj_name, preset : 'glib') diff --git a/po/meson_gen_potfiles.py b/po/meson_gen_potfiles.py new file mode 100755 index 00000000..9ea8a967 --- /dev/null +++ b/po/meson_gen_potfiles.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +# This script generates POTFILES for Meson from POTFILES.in for intltool + +import os + +print('Generating POTFILES for Meson...') +po_dir = os.path.dirname(__file__) +infile = os.path.join(po_dir, 'POTFILES.in') +outfile = os.path.join(po_dir, 'POTFILES') +with open(infile, 'r') as f_in: + with open(outfile, 'w') as f_out: + for l in f_in: + if l.startswith('data/'): + idx_last_sep = l.rindex('/') + f_out.write('{}meson_{}'.format( + l[:idx_last_sep + 1], l[idx_last_sep + 1:])) + else: + f_out.write(l) diff --git a/src/Makefile.am b/src/Makefile.am index 8aa96ead..7cac300e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,7 +34,7 @@ EXTRA_redshift_SOURCES = \ AM_CFLAGS = redshift_LDADD = @LIBINTL@ -EXTRA_DIST = windows/redshift.ico +EXTRA_DIST = windows/redshift.ico meson.build if ENABLE_DRM redshift_SOURCES += gamma-drm.c gamma-drm.h diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 00000000..3bbfae27 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,98 @@ +redshift_libs = [] +redshift_deps = [m_dep, intl_dep] +include_dirs = [configuration_inc] + +libredshift_common_sources = files( + 'colorramp.c', + 'colorramp.h', + 'config-ini.c', + 'config-ini.h', + 'gamma-dummy.c', + 'gamma-dummy.h', + 'location-manual.c', + 'location-manual.h', + 'options.c', + 'options.h', + 'pipeutils.c', + 'pipeutils.h', +) + +redshift_sources = files( + 'hooks.c', + 'hooks.h', + 'redshift.c', + 'redshift.h', + 'signals.c', + 'signals.h', + 'solar.c', + 'solar.h', + 'systemtime.c', + 'systemtime.h', +) + +if config_h.has('ENABLE_DRM') + libredshift_common_sources += files('gamma-drm.c', 'gamma-drm.h') + redshift_deps += drm_dep +endif + +if config_h.has('ENABLE_RANDR') + libredshift_common_sources += files('gamma-randr.c', 'gamma-randr.h') + redshift_deps += [xcb_randr_dep, xcb_dep] +endif + +if config_h.has('ENABLE_VIDMODE') + libredshift_common_sources += files('gamma-vidmode.c', 'gamma-vidmode.h') + redshift_deps += [xxf86vm_dep, x11_dep] +endif + +if config_h.has('ENABLE_QUARTZ') + libredshift_common_sources += files('gamma-quartz.c', 'gamma-quartz.h') + redshift_deps += appservices_dep +endif + +if config_h.has('ENABLE_WINGDI') + libredshift_common_sources += files('gamma-w32gdi.c', 'gamma-w32gdi.h') + redshift_deps += gdi32_dep +endif + +if config_h.has('ENABLE_GEOCLUE2') + libredshift_common_sources += files('location-geoclue2.c', 'location-geoclue2.h') + redshift_deps += gio_dep +endif + +# Build CoreLocation module as a separate convenience +# library since it is using a separate compiler +# (Objective C). +if config_h.has('ENABLE_CORELOCATION') + redshift_libs += static_library('libredshift_corelocation', + ['location-corelocation.m', 'location-corelocation.h'], + include_directories : include_dirs, + ) + redshift_deps += [corelocation_dep, foundation_dep, cocoa_dep] +endif + +if host_machine.system() == 'windows' + windows = import('windows') + # Windows resources + win_resources = windows.compile_resources( + ['windows/appicon.rc', 'windows/versioninfo.rc'], + include_directories : include_dirs, + ) + redshift_sources += win_resources +endif + +libredshift_common = static_library('libredshift_common', + libredshift_common_sources, + dependencies : redshift_deps, + include_directories : include_dirs, +) +redshift_libs += libredshift_common + +executable('redshift', + redshift_sources, + include_directories : include_dirs, + link_with : redshift_libs, + install : true, +) + +subdir('redshift-gtk') diff --git a/src/redshift-gtk/Makefile.am b/src/redshift-gtk/Makefile.am index b7303a26..56778af6 100644 --- a/src/redshift-gtk/Makefile.am +++ b/src/redshift-gtk/Makefile.am @@ -12,7 +12,7 @@ redshift_gtkdir = $(pythondir)/redshift_gtk bin_SCRIPTS = redshift-gtk endif -EXTRA_DIST = defs.py.in redshift-gtk.in +EXTRA_DIST = defs.py.in redshift-gtk.in meson_compile_py.py meson.build CLEANFILES = defs.py redshift-gtk diff --git a/src/redshift-gtk/meson.build b/src/redshift-gtk/meson.build new file mode 100644 index 00000000..fcdbf478 --- /dev/null +++ b/src/redshift-gtk/meson.build @@ -0,0 +1,29 @@ +if config_build.has('ENABLE_GUI') + py_installdir = join_paths(py_installation.get_install_dir(), 'redshift_gtk') + in_substs.set('pythondir', py_installdir) + + defs_py = configure_file( + input : 'defs.py.in', + output : 'defs.py', + configuration : in_substs, + ) + redshift_gtk = configure_file( + input : 'redshift-gtk.in', + output : 'redshift-gtk', + configuration : in_substs, + ) + redshift_gtk_sources = files( + '__init__.py', + 'controller.py', + 'statusicon.py', + 'utils.py', + ) + + py_installation.install_sources(redshift_gtk_sources, subdir : 'redshift_gtk') + install_data(defs_py, install_dir : py_installdir) + install_data(redshift_gtk, + install_dir : full_bindir, + install_mode : 'rwxr-xr-x', + ) + meson.add_install_script('meson_compile_py.py', py_installdir) +endif diff --git a/src/redshift-gtk/meson_compile_py.py b/src/redshift-gtk/meson_compile_py.py new file mode 100755 index 00000000..3bd1d3e7 --- /dev/null +++ b/src/redshift-gtk/meson_compile_py.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +from mesonbuild.scripts import destdir_join +import compileall, sys, os + +compileall.compile_dir( + destdir_join(os.environ.get('DESTDIR', ''), sys.argv[1])) From 944decca78ec7c1c1c07f48e208bee73cd206111 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 21 Oct 2018 16:43:19 +0900 Subject: [PATCH 02/19] Meson: Replace autotools-based build system --- .gitignore | 43 -- .travis.yml | 146 +++---- CONTRIBUTING.md | 40 +- Makefile.am | 156 ------- appveyor.yml | 52 +-- bootstrap | 7 - build-win32.txt | 15 + build-win64.txt | 15 + configure.ac | 392 ------------------ contrib/redshift.spec | 7 +- data/appdata/meson.build | 2 +- .../appdata/meson_redshift-gtk.appdata.xml.in | 20 - data/appdata/redshift-gtk.appdata.xml.in | 14 +- data/applications/meson.build | 4 +- .../meson_redshift-gtk.desktop.in | 12 - data/applications/meson_redshift.desktop.in | 12 - data/applications/redshift-gtk.desktop.in | 7 +- data/applications/redshift.desktop.in | 7 +- po/Makevars | 41 -- po/{POTFILES.in => POTFILES} | 0 po/meson.build | 4 - po/meson_gen_potfiles.py | 19 - src/Makefile.am | 105 ----- src/redshift-gtk/Makefile.am | 25 -- 24 files changed, 136 insertions(+), 1009 deletions(-) delete mode 100644 Makefile.am delete mode 100755 bootstrap create mode 100644 build-win32.txt create mode 100644 build-win64.txt delete mode 100644 configure.ac delete mode 100644 data/appdata/meson_redshift-gtk.appdata.xml.in delete mode 100644 data/applications/meson_redshift-gtk.desktop.in delete mode 100644 data/applications/meson_redshift.desktop.in mode change 100755 => 100644 data/applications/redshift-gtk.desktop.in mode change 100755 => 100644 data/applications/redshift.desktop.in delete mode 100644 po/Makevars rename po/{POTFILES.in => POTFILES} (100%) delete mode 100755 po/meson_gen_potfiles.py delete mode 100644 src/Makefile.am delete mode 100644 src/redshift-gtk/Makefile.am diff --git a/.gitignore b/.gitignore index d56a6b60..ecb33983 100644 --- a/.gitignore +++ b/.gitignore @@ -54,55 +54,13 @@ Module.symvers Mkfile.old dkms.conf -## From: https://github.com/github/gitignore/blob/master/Autotools.gitignore -# http://www.gnu.org/software/automake - -Makefile.in -/ar-lib -/mdate-sh -/py-compile -/test-driver -/ylwrap - -# http://www.gnu.org/software/autoconf - -autom4te.cache -/autoscan.log -/autoscan-*.log -/aclocal.m4 -/compile -/config.guess -/config.h.in -/config.log -/config.status -/config.sub -/configure -/configure.scan -/depcomp -/install-sh -/missing -/stamp-h1 - -# https://www.gnu.org/software/libtool/ - -/ltmain.sh - # http://www.gnu.org/software/texinfo /texinfo.tex -# http://www.gnu.org/software/m4/ - -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 - ## Redshift specific: # generated files /ABOUT-NLS -/config.rpath /contrib/redshift.spec /data/apparmor/usr.bin.redshift /data/appdata/redshift-gtk.appdata.xml @@ -110,7 +68,6 @@ m4/lt~obsolete.m4 /data/applications/redshift-gtk.desktop /data/systemd/redshift.service /data/systemd/redshift-gtk.service -/m4 /src/redshift /src/redshift-gtk/defs.py /src/redshift-gtk/redshift-gtk diff --git a/.travis.yml b/.travis.yml index 8fd075bf..df7640d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,16 +7,8 @@ matrix: include: - os: linux compiler: gcc - env: USE_MESON=0 - - os: linux - compiler: gcc - env: USE_MESON=1 - - os: osx - compiler: clang - env: USE_MESON=0 - os: osx compiler: clang - env: USE_MESON=1 addons: apt: @@ -41,116 +33,84 @@ install: brew update brew install gettext brew link --force gettext - if [ "$USE_MESON" -eq "1" ]; then - # Building with Meson sometimes fails due to its regressions. - # Meson can be installed via brew, but - # we install it via pip to pin its version. - # Meson uses Ninja and we install it via brew. - brew install ninja - else - brew install intltool - - # distuninstallcheck fails on macOS when automake 1.16 or 1.16.1 is used. - # http://gnu-automake.7480.n7.nabble.com/bug-31222-automake-1-16-1-am-pep3147-tweak-bug-td22937.html - # No upstream release yet, use upstream patch. - pushd /usr/local/Cellar/automake/*/share/automake-* - curl "https://git.savannah.gnu.org/cgit/automake.git/patch/?id=a348d830659fffd2cfc42994524783b07e69b4b5" | tail -n 14 | sudo patch -p2 - popd - fi - # Note: No longer needed. - brew upgrade python - fi - - | - if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$USE_MESON" -eq "0" ]; then - sudo apt-get install autopoint intltool + # Building with Meson sometimes fails due to its regressions. + # Meson can be installed via brew, but + # we install it via pip to pin its version. + # Meson uses Ninja and we install it via brew. + brew install ninja + # Note: No longer needed. Errors can be ignored. + brew upgrade python || true fi - | if [ "$TRAVIS_OS_NAME" == "linux" ]; then - if [ "$USE_MESON" -eq "1" ]; then - # We need to use newer versions of Ninja and gettext to - # get Meson to work on Ubuntu 14.04 LTS (Trusty). + # We need to use newer versions of Ninja and gettext to + # get Meson to work on Ubuntu 14.04 LTS (Trusty). - # Ninja: From official GitHub repo, smaller than other versions - ninja_url=https://github.com/ninja-build/ninja/releases/download/v1.5.3/ninja-linux.zip - wget -O - "$ninja_url" | funzip > ninja - sudo install -m 755 ninja /usr/bin + # Ninja: From official GitHub repo, smaller than other versions + ninja_url=https://github.com/ninja-build/ninja/releases/download/v1.5.3/ninja-linux.zip + wget -O - "$ninja_url" | funzip > ninja + sudo install -m 755 ninja /usr/bin - # gettext and its dependencies: From Ubuntu 18.04 LTS (Bionic) mirror - # * Only msgfmt and xgettext need to be upgraded to 0.19.7+. - # * appdata.{its,loc} are needed too. - gettext_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/g/gettext/gettext_0.19.8.1-6_amd64.deb - libtinfo_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1_amd64.deb - libunistring_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/libu/libunistring/libunistring2_0.9.9-0ubuntu1_amd64.deb - for url in "$gettext_url" "$libtinfo_url" "$libunistring_url"; do - wget "$url" - done - ar p gettext*.deb data.tar.xz > gettext.tar.xz - ar p libtinfo*.deb data.tar.xz > libtinfo.tar.xz - ar p libunistring*.deb data.tar.xz > libunistring.tar.xz - cmd="tar -C / -Jxf gettext.tar.xz" - cmd="$cmd ./usr/bin/msgfmt" - cmd="$cmd ./usr/bin/xgettext" - cmd="$cmd ./usr/lib/x86_64-linux-gnu/libgettext{lib,src}{,-0.19.8.1}.so" - cmd="$cmd ./usr/share/gettext-0.19.8/its/appdata.{its,loc} &&" - cmd="$cmd tar -C / -Jxf libtinfo.tar.xz" - cmd="$cmd ./lib/x86_64-linux-gnu/libtinfo.so.5{.9,} &&" - cmd="$cmd tar -C / -Jxf libunistring.tar.xz" - cmd="$cmd ./usr/lib/x86_64-linux-gnu/libunistring.so.2{.1.0,}" - sudo bash -c "$cmd" + # gettext and its dependencies: From Ubuntu 18.04 LTS (Bionic) mirror + # * Only msgfmt and xgettext need to be upgraded to 0.19.7+. + # * appdata.{its,loc} are needed too. + gettext_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/g/gettext/gettext_0.19.8.1-6_amd64.deb + libtinfo_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1_amd64.deb + libunistring_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/libu/libunistring/libunistring2_0.9.9-0ubuntu1_amd64.deb + for url in "$gettext_url" "$libtinfo_url" "$libunistring_url"; do + wget "$url" + done + ar p gettext*.deb data.tar.xz > gettext.tar.xz + ar p libtinfo*.deb data.tar.xz > libtinfo.tar.xz + ar p libunistring*.deb data.tar.xz > libunistring.tar.xz + cmd="tar -C / -Jxf gettext.tar.xz" + cmd="$cmd ./usr/bin/msgfmt" + cmd="$cmd ./usr/bin/xgettext" + cmd="$cmd ./usr/lib/x86_64-linux-gnu/libgettext{lib,src}{,-0.19.8.1}.so" + cmd="$cmd ./usr/share/gettext-0.19.8/its/appdata.{its,loc} &&" + cmd="$cmd tar -C / -Jxf libtinfo.tar.xz" + cmd="$cmd ./lib/x86_64-linux-gnu/libtinfo.so.5{.9,} &&" + cmd="$cmd tar -C / -Jxf libunistring.tar.xz" + cmd="$cmd ./usr/lib/x86_64-linux-gnu/libunistring.so.2{.1.0,}" + sudo bash -c "$cmd" - # Set PATH to use Python 3.6 and Meson - # Note: Python 3.6 is available without additional download. - export PATH=~/virtualenv/python3.6/bin:~/.local/bin:$PATH - fi + # Set PATH to use Python 3.6 and Meson + # Note: Python 3.6 is available without additional download. + export PATH=~/virtualenv/python3.6/bin:~/.local/bin:$PATH fi # Note: Meson 0.48.0 prints target name related warnings. # (already fixed upstream but no release yet) - - if [ "$USE_MESON" -eq "1" ]; then pip3 install meson==0.47.2; fi + - pip3 install meson==0.47.2 before_script: - | if [ "$TRAVIS_OS_NAME" == "linux" ]; then CONF_FLAGS="--prefix=$TRAVIS_BUILD_DIR/root" - if [ "$USE_MESON" -eq "1" ]; then - CONF_FLAGS="$CONF_FLAGS -Ddrm=enabled -Drandr=enabled" - CONF_FLAGS="$CONF_FLAGS -Dvidmode=enabled -Dquartz=disabled" - CONF_FLAGS="$CONF_FLAGS -Dwingdi=disabled -Dgeoclue2=enabled" - CONF_FLAGS="$CONF_FLAGS -Dcorelocation=disabled -Dgui=enabled" - CONF_FLAGS="$CONF_FLAGS -Dubuntu=disabled -Dapparmor=enabled" - else - CONF_FLAGS="$CONF_FLAGS --enable-drm --enable-vidmode --enable-randr" - CONF_FLAGS="$CONF_FLAGS --enable-geoclue2 --enable-gui --enable-apparmor" - fi + CONF_FLAGS="$CONF_FLAGS -Ddrm=enabled -Drandr=enabled" + CONF_FLAGS="$CONF_FLAGS -Dvidmode=enabled -Dquartz=disabled" + CONF_FLAGS="$CONF_FLAGS -Dwingdi=disabled -Dgeoclue2=enabled" + CONF_FLAGS="$CONF_FLAGS -Dcorelocation=disabled -Dgui=enabled" + CONF_FLAGS="$CONF_FLAGS -Dubuntu=disabled -Dapparmor=enabled" export CONF_FLAGS fi - | if [ "$TRAVIS_OS_NAME" == "osx" ]; then CONF_FLAGS="--prefix=$TRAVIS_BUILD_DIR/root" - if [ "$USE_MESON" -eq "1" ]; then - CONF_FLAGS="$CONF_FLAGS -Ddrm=disabled -Drandr=disabled" - CONF_FLAGS="$CONF_FLAGS -Dvidmode=disabled -Dquartz=enabled" - CONF_FLAGS="$CONF_FLAGS -Dwingdi=disabled -Dgeoclue2=disabled" - CONF_FLAGS="$CONF_FLAGS -Dcorelocation=enabled -Dgui=disabled" - CONF_FLAGS="$CONF_FLAGS -Dubuntu=disabled -Dapparmor=disabled" - else - CONF_FLAGS="$CONF_FLAGS --enable-corelocation --enable-quartz" - fi + CONF_FLAGS="$CONF_FLAGS -Ddrm=disabled -Drandr=disabled" + CONF_FLAGS="$CONF_FLAGS -Dvidmode=disabled -Dquartz=enabled" + CONF_FLAGS="$CONF_FLAGS -Dwingdi=disabled -Dgeoclue2=disabled" + CONF_FLAGS="$CONF_FLAGS -Dcorelocation=enabled -Dgui=disabled" + CONF_FLAGS="$CONF_FLAGS -Dubuntu=disabled -Dapparmor=disabled" export CONF_FLAGS fi script: - # Build with Meson - - if [ "$USE_MESON" -eq "1" ]; then meson $CONF_FLAGS _build; fi - - if [ "$USE_MESON" -eq "1" ]; then ninja -v -C _build install; fi + - meson $CONF_FLAGS _build + - ninja -v -C _build install # Note: "test" and "dist" fail with Meson 0.48.0. # (already fixed upstream, will be fixed in next release) - - if [ "$USE_MESON" -eq "1" ]; then ninja -v -C _build test; fi - - if [ "$USE_MESON" -eq "1" ]; then ninja -v -C _build dist; fi - # Build with autotools-based build system - - if [ "$USE_MESON" -eq "0" ]; then ./bootstrap; fi - - if [ "$USE_MESON" -eq "0" ]; then ./configure $CONF_FLAGS; fi - - if [ "$USE_MESON" -eq "0" ]; then make -j2 install; fi - - if [ "$USE_MESON" -eq "0" ]; then make -j2 distcheck; fi + - ninja -v -C _build test + - ninja -v -C _build dist # redshift tests - | "$TRAVIS_BUILD_DIR"/root/bin/redshift -l 12:-34 -pv diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c8a29e75..55714fbd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,39 +3,37 @@ Building from git clone ----------------------- ``` shell -$ ./bootstrap -$ ./configure +$ meson ([options...]) _build ``` -The bootstrap script will use autotools to set up the build environment -and create the `configure` script. +Meson sets up the build environment and create a build directory named `_build`. -Use `./configure --help` for options. Use `--prefix` to make an install in +See `meson_options.txt` for options. Use `--prefix` to make an install in your home directory. This is necessary to test python scripts. The systemd user unit directory should be set to avoid writing to the system location. Systemd will look for the unit files in `~/.config/systemd/user` so this directory can be used as a target if the unit files will be used. Otherwise -the location can be set to `no` to disable the systemd files. +the location can be set to `disabled` to disable the systemd files. Example: ``` shell -$ ./configure --prefix=$HOME/redshift/root \ - --with-systemduserunitdir=$HOME/.config/systemd/user +$ meson --prefix=$HOME/redshift/root \ + -Dsystemduserunitdir=$HOME/.config/systemd/user ``` Now, build the files: ``` shell -$ make +$ ninja -C _build ``` The main redshift program can be run at this point. To install to the prefix directory run: ``` shell -$ make install +$ ninja -C _build install ``` You can now run the python script. Example: @@ -48,8 +46,9 @@ $ $HOME/redshift/root/bin/redshift-gtk Dependencies ------------ -* autotools, gettext -* intltool, libtool +* Meson (>= 0.47.0) +* gettext (>= 0.19.7) +* Ninja (>= 1.5) * libdrm (Optional, for DRM support) * libxcb, libxcb-randr (Optional, for RandR support) * libX11, libXxf86vm (Optional, for VidMode support) @@ -138,8 +137,8 @@ Creating a new release 3. Apply any bugfixes for release 4. Import updated translations from launchpad and commit. Remember to update `po/LINGUAS` if new languages were added -5. Update version in `configure.ac` and create entry in NEWS -6. Run `make distcheck` +5. Update version in `meson.build` and create entry in NEWS +6. Run `ninja -C _build dist` 7. Commit and tag release (`vX.Y` or `vX.Y.Z`) 8. Push tag to Github and also upload source dist file to Github @@ -152,7 +151,7 @@ Also remember to check before release that Build Fedora RPMs ----------------- -Run `make dist-xz` and copy the `.tar.xz` file to `~/rpmbuild/SOURCES`. Then run +Run `ninja -C _build dist` and copy the `.tar.xz` file to `~/rpmbuild/SOURCES`. Then run ``` shell $ rpmbuild -ba contrib/redshift.spec @@ -164,13 +163,14 @@ If successful this will place RPMs in `~/rpmbuild/RPMS`. Cross-compile for Windows ------------------------- -Install MinGW and run `configure` using the following command line. Use -`i686-w64-mingw32` as host for 32-bit builds. +Install mingw-w64 and run `meson` using the following command line. ``` shell -$ ./configure --disable-drm --disable-randr --disable-vidmode --enable-wingdi \ - --disable-quartz --disable-geoclue2 --disable-corelocation --disable-gui \ - --disable-ubuntu --host=x86_64-w64-mingw32 +(Win64) +$ meson --cross-file build-win64.txt _build + +(Win32) +$ meson --cross-file build-win32.txt _build ``` diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index a3b1bbb7..00000000 --- a/Makefile.am +++ /dev/null @@ -1,156 +0,0 @@ - -SUBDIRS = src po -ACLOCAL_AMFLAGS = -I m4 - -# Install systemd user unit files locally for distcheck -DISTCHECK_CONFIGURE_FLAGS = \ - --with-systemduserunitdir=$$dc_install_base/$(systemduserunitdir) - -UPDATE_ICON_CACHE = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor || : - -EXTRA_ROOTDOC_FILES = \ - CONTRIBUTING.md \ - DESIGN \ - README \ - README-colorramp \ - redshift.conf.sample - -_HICOLOR_FILES = \ - data/icons/hicolor/scalable/apps/redshift.svg \ - data/icons/hicolor/scalable/apps/redshift-status-on.svg \ - data/icons/hicolor/scalable/apps/redshift-status-off.svg - -_UBUNTU_MONO_DARK_FILES = \ - data/icons/ubuntu-mono-dark/scalable/apps/redshift-status-on.svg \ - data/icons/ubuntu-mono-dark/scalable/apps/redshift-status-off.svg - -_UBUNTU_MONO_LIGHT_FILES = \ - data/icons/ubuntu-mono-light/scalable/apps/redshift-status-on.svg \ - data/icons/ubuntu-mono-light/scalable/apps/redshift-status-off.svg - -DESKTOP_IN_FILES = \ - data/applications/redshift.desktop.in \ - data/applications/redshift-gtk.desktop.in - -SYSTEMD_USER_UNIT_IN_FILES = \ - data/systemd/redshift.service.in \ - data/systemd/redshift-gtk.service.in - -APPDATA_IN_FILES = \ - data/appdata/redshift-gtk.appdata.xml.in - -APPARMOR_IN_FILES = \ - data/apparmor/usr.bin.redshift.in - -MESON_FILES = \ - meson_options.txt \ - meson.build \ - po/meson.build \ - po/meson_gen_potfiles.py \ - data/meson.build \ - data/apparmor/meson.build \ - data/appdata/meson.build \ - data/appdata/meson_redshift-gtk.appdata.xml.in \ - data/applications/meson.build \ - data/applications/meson_redshift-gtk.desktop.in \ - data/applications/meson_redshift.desktop.in \ - data/systemd/meson.build - - -# Icons -if ENABLE_GUI -hicolor_icondir = @datadir@/icons/hicolor/scalable/apps -hicolor_icon_DATA = $(_HICOLOR_FILES) - -if ENABLE_UBUNTU -ubuntu_mono_dark_icondir = @datadir@/icons/ubuntu-mono-dark/scalable/apps -ubuntu_mono_dark_icon_DATA = $(_UBUNTU_MONO_DARK_FILES) - -ubuntu_mono_light_icondir = @datadir@/icons/ubuntu-mono-light/scalable/apps -ubuntu_mono_light_icon_DATA = $(_UBUNTU_MONO_LIGHT_FILES) -endif -endif - - -# Desktop file -if ENABLE_GUI -desktopdir = @datadir@/applications -desktop_DATA = $(DESKTOP_IN_FILES:.desktop.in=.desktop) -endif - -if ENABLE_GUI -install-data-hook: - $(UPDATE_ICON_CACHE); - -uninstall-hook: - $(UPDATE_ICON_CACHE); - -# We would preferable use @INTLTOOL_DESKTOP_RULE@ here but -# sadly it is broken for out-of-tree builds. -%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) - $(AM_V_GEN)$(MKDIR_P) $(@D); - $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ -endif - - -# man page -dist_man1_MANS = redshift.1 - - -# Systemd service files -if ENABLE_SYSTEMD -systemduserunit_DATA = $(SYSTEMD_USER_UNIT_IN_FILES:.service.in=.service) -endif - -$(systemduserunit_DATA): $(SYSTEMD_USER_UNIT_IN_FILES) Makefile - $(AM_V_GEN)$(MKDIR_P) $(@D) && \ - sed -e "s|\@bindir\@|$(bindir)|g" "$(srcdir)/$(@:.service=.service.in)" > $@ - - -# Appdata file -if ENABLE_GUI -appdatadir = @datadir@/appdata -appdata_DATA = $(APPDATA_IN_FILES:.xml.in=.xml) - -# We would preferable use @INTLTOOL_XML_RULE@ here but -# sadly it is broken for out-of-tree builds. -%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) - $(AM_V_GEN)$(MKDIR_P) $(@D); - $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ -endif - - -# AppArmor profile -if ENABLE_APPARMOR -apparmordir = @sysconfdir@/apparmor.d -apparmor_DATA = $(APPARMOR_IN_FILES:.in=) - -$(apparmor_DATA): $(APPARMOR_IN_FILES) Makefile - $(AM_V_GEN)$(MKDIR_P) $(@D) && \ - sed -e "s|\@bindir\@|$(bindir)|g" "$(srcdir)/$(@:=.in)" > $@ -endif - - - -EXTRA_DIST = \ - $(EXTRA_ROOTDOC_FILES) \ - $(_HICOLOR_FILES) \ - $(_UBUNTU_MONO_DARK_FILES) \ - $(_UBUNTU_MONO_LIGHT_FILES) \ - $(DESKTOP_IN_FILES) \ - $(SYSTEMD_USER_UNIT_IN_FILES) \ - $(APPDATA_IN_FILES) \ - $(APPARMOR_IN_FILES) \ - $(MESON_FILES) - -CLEANFILES = \ - $(desktop_DATA) \ - $(systemduserunit_DATA) \ - $(appdata_DATA) \ - $(apparmor_DATA) - - -# Update PO translations -.PHONY: update-po -update-po: - cd po && $(MAKE) POTFILES redshift.pot update-po diff --git a/appveyor.yml b/appveyor.yml index 08a68319..5c6c221d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,21 +3,9 @@ image: environment: matrix: - # MSYS2 + mingw-w64 - arch: x86_64 - use_meson: 0 - MSYSTEM: MINGW64 - PATH: C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%; - - arch: i686 - use_meson: 0 - MSYSTEM: MINGW32 - PATH: C:\msys64\mingw32\bin;C:\msys64\usr\bin;%PATH%; - # Meson + mingw-w64 - - arch: x86_64 - use_meson: 1 PATH: C:\Python37;C:\Python37\scripts;C:\msys64\mingw64\bin;%PATH%; - arch: i686 - use_meson: 1 PATH: C:\Python37;C:\Python37\scripts;C:\msys64\mingw32\bin;%PATH%; build: @@ -25,45 +13,27 @@ build: install: - ps: | - if ($env:use_meson -eq "1") { - Start-FileDownload "https://raw.githubusercontent.com/mesonbuild/cidata/e5ea5b021d8144515a1b8f576cda327e45a81235/ninja.exe" - } + Start-FileDownload "https://raw.githubusercontent.com/mesonbuild/cidata/e5ea5b021d8144515a1b8f576cda327e45a81235/ninja.exe" # Use working versions of Meson -- if "%use_meson%" == "1" ( pip3 install meson==0.47.2 ) +- pip3 install meson==0.47.2 before_build: - ps: | - if ($env:use_meson -eq "1") { - $env:CONF_FLAGS = "--prefix=${env:APPVEYOR_BUILD_FOLDER}\root" - $env:CONF_FLAGS += " -Ddrm=disabled -Drandr=disabled -Dvidmode=disabled" - $env:CONF_FLAGS += " -Dwingdi=enabled -Dquartz=disabled" - $env:CONF_FLAGS += " -Dgeoclue2=disabled -Dcorelocation=disabled" - $env:CONF_FLAGS += " -Dgui=disabled -Dubuntu=disabled -Dnls=disabled" - - # For Ninja - $env:PATH = "${env:APPVEYOR_BUILD_FOLDER};${env:PATH};" - } else { - $env:CONF_FLAGS = "--host=${env:arch}-w64-mingw32" - $env:CONF_FLAGS += " --disable-drm --disable-randr --disable-vidmode" - $env:CONF_FLAGS += " --enable-wingdi --disable-quartz --disable-geoclue2" - $env:CONF_FLAGS += " --disable-corelocation --disable-gui" - $env:CONF_FLAGS += " --disable-ubuntu --disable-nls" + $env:CONF_FLAGS = "--prefix=${env:APPVEYOR_BUILD_FOLDER}\root" + $env:CONF_FLAGS += " -Ddrm=disabled -Drandr=disabled -Dvidmode=disabled" + $env:CONF_FLAGS += " -Dwingdi=enabled -Dquartz=disabled" + $env:CONF_FLAGS += " -Dgeoclue2=disabled -Dcorelocation=disabled" + $env:CONF_FLAGS += " -Dgui=disabled -Dubuntu=disabled -Dnls=disabled" - # For MSYS2 - $env:HOME = $env:APPVEYOR_BUILD_FOLDER - } + # For Ninja + $env:PATH = "${env:APPVEYOR_BUILD_FOLDER};${env:PATH};" build_script: - ps: md (Join-Path $env:APPVEYOR_BUILD_FOLDER root) -- if "%use_meson%" == "1" ( meson %CONF_FLAGS% _build && +- meson %CONF_FLAGS% _build && ninja -C _build install && ninja -C _build test && - ninja -C _build dist ) -- if "%use_meson%" == "0" ( - bash -lc "./bootstrap" && - bash -lc "./configure --prefix=\"$APPVEYOR_BUILD_FOLDER/root\" $CONF_FLAGS" && - bash -lc "make install" && - bash -lc "make distcheck DISTCHECK_CONFIGURE_FLAGS=\"$CONF_FLAGS\"" ) + ninja -C _build dist test_script: - | diff --git a/bootstrap b/bootstrap deleted file mode 100755 index 0599cf5f..00000000 --- a/bootstrap +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# change to root directory -cd $(dirname "$0") - -autopoint --force && \ - AUTOPOINT="intltoolize --automake --copy" autoreconf --force --install --verbose diff --git a/build-win32.txt b/build-win32.txt new file mode 100644 index 00000000..e1155330 --- /dev/null +++ b/build-win32.txt @@ -0,0 +1,15 @@ +[binaries] +c = 'i686-w64-mingw32-gcc' +ar = 'i686-w64-mingw32-ar' +strip = 'i686-w64-mingw32-strip' +windres = 'i686-w64-mingw32-windres' +exe_wrapper = 'wine' + +[properties] +c_link_args = ['-static', '-static-libgcc'] + +[host_machine] +system = 'windows' +cpu_family = 'x86' +cpu = 'x86' +endian = 'little' diff --git a/build-win64.txt b/build-win64.txt new file mode 100644 index 00000000..9ea2c5dc --- /dev/null +++ b/build-win64.txt @@ -0,0 +1,15 @@ +[binaries] +c = 'x86_64-w64-mingw32-gcc' +ar = 'x86_64-w64-mingw32-ar' +strip = 'x86_64-w64-mingw32-strip' +windres = 'x86_64-w64-mingw32-windres' +exe_wrapper = 'wine' + +[properties] +c_link_args = ['-static', '-static-libgcc'] + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' diff --git a/configure.ac b/configure.ac deleted file mode 100644 index b4116262..00000000 --- a/configure.ac +++ /dev/null @@ -1,392 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ([2.69]) -AC_INIT([redshift], [1.12], [https://github.com/jonls/redshift/issues]) -AC_CONFIG_SRCDIR([src/redshift.c]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz]) - -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -# Checks for programs. -AC_PROG_CC_C99 -AC_PROG_LIBTOOL -AC_PROG_OBJC # For macOS support modules -AC_LANG([C]) - -AC_PROG_INTLTOOL([0.50]) - -AC_CANONICAL_HOST - -# Test host platform -build_windows=no -case "${host_os}" in - mingw*) - build_windows=yes - ;; -esac - -# Test whether to compile Windows resources -AC_CHECK_TOOL([WINDRES], [windres], []) -AS_IF([test "x$build_windows" = "xyes" -a -n "x$WINDRES"], [ - enable_windows_resource=yes -], [ - enable_windows_resource=no -]) -AM_CONDITIONAL([ENABLE_WINDOWS_RESOURCE], - [test "x$enable_windows_resource" = xyes]) - - -# Test whether Objective C compiler works -AC_MSG_CHECKING([whether Objective C compiler works]) -AC_LANG_PUSH([Objective C]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [ - AC_MSG_RESULT([yes]) - have_objc_compiler=yes -], [ - AC_MSG_RESULT([no]) - have_objc_compiler=no -]) -AC_LANG_POP([Objective C]) - -# Checks for libraries. -AM_GNU_GETTEXT_VERSION([0.17]) -AM_GNU_GETTEXT([external]) - -GETTEXT_PACKAGE=redshift -AC_SUBST(GETTEXT_PACKAGE) -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext]) - - -PKG_CHECK_MODULES([DRM], [libdrm], [have_drm=yes], [have_drm=no]) - -PKG_CHECK_MODULES([X11], [x11], [have_x11=yes], [have_x11=no]) -PKG_CHECK_MODULES([XF86VM], [xxf86vm], [have_xf86vm=yes], [have_xf86vm=no]) -PKG_CHECK_MODULES([XCB], [xcb], [have_xcb=yes], [have_xcb=no]) -PKG_CHECK_MODULES([XCB_RANDR], [xcb-randr], - [have_xcb_randr=yes], [have_xcb_randr=no]) - -PKG_CHECK_MODULES([GLIB], [glib-2.0 gobject-2.0], [have_glib=yes], [have_glib=no]) -PKG_CHECK_MODULES([GEOCLUE2], [glib-2.0 gio-2.0 >= 2.26], [have_geoclue2=yes], [have_geoclue2=no]) - -# macOS headers -AC_CHECK_HEADER([ApplicationServices/ApplicationServices.h], [have_appserv_h=yes], [have_appserv_h=no]) - -# CoreLocation.h is an Objective C header. Only test if -# Objective C compiler works. AC_CHECK_HEADER does not -# appear to work if the Ojective C compiler is not -# available so we need a custom test. -AC_MSG_CHECKING([whether CoreLocation/CoreLocation.h is usable]) -AS_IF([test "x$have_objc_compiler" = xyes], [ - AC_LANG_PUSH([Objective C]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#import ]],[[]])], [ - AC_MSG_RESULT([yes]) - have_corelocation_h=yes - ], [ - AC_MSG_RESULT([no]) - have_corelocation_h=no - ]) - AC_LANG_POP([Objective C]) -], [ - AC_MSG_RESULT([no Objective C compiler available]) - have_corelocation_h=no -]) - -# Windows header -AC_CHECK_HEADER([windows.h], [have_windows_h=yes], [have_windows_h=no]) - -# Check for Python -AM_PATH_PYTHON([3.2], [have_python=yes], [have_python=no]) - -# Check DRM method -AC_MSG_CHECKING([whether to enable DRM method]) -AC_ARG_ENABLE([drm], [AC_HELP_STRING([--enable-drm], - [enable DRM method])], - [enable_drm=$enableval],[enable_drm=maybe]) -AS_IF([test "x$enable_drm" != xno], [ - AS_IF([test $have_drm = yes], [ - AC_DEFINE([ENABLE_DRM], 1, - [Define to 1 to enable DRM method]) - AC_MSG_RESULT([yes]) - enable_drm=yes - ], [ - AC_MSG_RESULT([missing dependencies]) - AS_IF([test "x$enable_drm" = xyes], [ - AC_MSG_ERROR([missing dependencies for DRM method]) - ]) - enable_drm=no - ]) -], [ - AC_MSG_RESULT([no]) - enable_drm=no -]) -AM_CONDITIONAL([ENABLE_DRM], [test "x$enable_drm" = xyes]) - -# Check RANDR method -AC_MSG_CHECKING([whether to enable RANDR method]) -AC_ARG_ENABLE([randr], [AC_HELP_STRING([--enable-randr], - [enable RANDR method])], - [enable_randr=$enableval],[enable_randr=maybe]) -AS_IF([test "x$enable_randr" != xno], [ - AS_IF([test $have_xcb = yes -a $have_xcb_randr = yes], [ - AC_DEFINE([ENABLE_RANDR], 1, - [Define to 1 to enable RANDR method]) - AC_MSG_RESULT([yes]) - enable_randr=yes - ], [ - AC_MSG_RESULT([missing dependencies]) - AS_IF([test "x$enable_randr" = xyes], [ - AC_MSG_ERROR([missing dependencies for RANDR method]) - ]) - enable_randr=no - ]) -], [ - AC_MSG_RESULT([no]) - enable_randr=no -]) -AM_CONDITIONAL([ENABLE_RANDR], [test "x$enable_randr" = xyes]) - -# Check VidMode method -AC_MSG_CHECKING([whether to enable VidMode method]) -AC_ARG_ENABLE([vidmode], [AC_HELP_STRING([--enable-vidmode], - [enable VidMode method])], - [enable_vidmode=$enableval],[enable_vidmode=maybe]) -AS_IF([test "x$enable_vidmode" != xno], [ - AS_IF([test $have_x11 = yes -a $have_xf86vm = yes], [ - AC_DEFINE([ENABLE_VIDMODE], 1, - [Define to 1 to enable VidMode method]) - AC_MSG_RESULT([yes]) - enable_vidmode=yes - ], [ - AC_MSG_RESULT([missing dependencies]) - AS_IF([test "x$enable_vidmode" = xyes], [ - AC_MSG_ERROR([missing dependencies for VidMode method]) - ]) - enable_vidmode=no - ]) -], [ - AC_MSG_RESULT([no]) - enable_vidmode=no -]) -AM_CONDITIONAL([ENABLE_VIDMODE], [test "x$enable_vidmode" = xyes]) - -# Check Quartz (macOS) method -AC_MSG_CHECKING([whether to enable Quartz method]) -AC_ARG_ENABLE([quartz], [AC_HELP_STRING([--enable-quartz], - [enable Quartz (macOS) method])], - [enable_quartz=$enableval],[enable_quartz=maybe]) -AS_IF([test "x$enable_quartz" != xno], [ - AS_IF([test $have_appserv_h = yes], [ - QUARTZ_CFLAGS="" - QUARTZ_LIBS="-framework ApplicationServices" - AC_DEFINE([ENABLE_QUARTZ], 1, - [Define to 1 to enable Quartz method]) - AC_MSG_RESULT([yes]) - enable_quartz=yes - ], [ - AC_MSG_RESULT([missing dependencies]) - AS_IF([test "x$enable_quartz" = xyes], [ - AC_MSG_ERROR([missing Quartz headers]) - ]) - enable_quartz=no - ]) -], [ - AC_MSG_RESULT([no]) - enable_quartz=no -]) -AM_CONDITIONAL([ENABLE_QUARTZ], [test "x$enable_quartz" = xyes]) -AC_SUBST([QUARTZ_CFLAGS]) -AC_SUBST([QUARTZ_LIBS]) - -# Check Windows GDI method -AC_MSG_CHECKING([whether to enable WinGDI method]) -AC_ARG_ENABLE([wingdi], [AC_HELP_STRING([--enable-wingdi], - [enable WinGDI method])], - [enable_wingdi=$enableval],[enable_wingdi=maybe]) -AS_IF([test "x$enable_wingdi" != xno], [ - AS_IF([test $have_windows_h = yes], [ - AC_DEFINE([ENABLE_WINGDI], 1, - [Define to 1 to enable WinGDI method]) - AC_MSG_RESULT([yes]) - enable_wingdi=yes - ], [ - AC_MSG_RESULT([missing dependencies]) - AS_IF([test "x$enable_wingdi" = xyes], [ - AC_MSG_ERROR([missing Windows API headers for WinGDI method]) - ]) - enable_wingdi=no - ]) -], [ - AC_MSG_RESULT([no]) - enable_wingdi=no -]) -AM_CONDITIONAL([ENABLE_WINGDI], [test "x$enable_wingdi" = xyes]) - - -# Check Geoclue2 location provider -AC_MSG_CHECKING([whether to enable Geoclue2 location provider]) -AC_ARG_ENABLE([geoclue2], [AC_HELP_STRING([--enable-geoclue2], - [enable Geoclue2 location provider])], - [enable_geoclue2=$enableval],[enable_geoclue2=maybe]) -AS_IF([test "x$enable_geoclue2" != xno], [ - AS_IF([test "x$have_geoclue2" = xyes], [ - AC_DEFINE([ENABLE_GEOCLUE2], 1, - [Define to 1 to enable Geoclue2 location provider]) - AC_MSG_RESULT([yes]) - enable_geoclue2=yes - ], [ - AC_MSG_RESULT([missing dependencies]) - AS_IF([test "x$enable_geoclue2" = xyes], [ - AC_MSG_ERROR([missing dependencies for Geoclue2 location provider]) - ]) - enable_geoclue2=no - ]) -], [ - AC_MSG_RESULT([no]) - enable_geoclue2=no -]) -AM_CONDITIONAL([ENABLE_GEOCLUE2], [test "x$enable_geoclue2" = xyes]) - -# Check CoreLocation (macOS) provider -AC_MSG_CHECKING([whether to enable CoreLocation method]) -AC_ARG_ENABLE([corelocation], [AC_HELP_STRING([--enable-corelocation], - [enable CoreLocation (macOS) provider])], - [enable_corelocation=$enableval],[enable_corelocation=maybe]) -AS_IF([test "x$enable_corelocation" != xno], [ - AS_IF([test "x$have_corelocation_h" = xyes], [ - CORELOCATION_CFLAGS="" - CORELOCATION_LIBS="-framework Foundation -framework Cocoa -framework CoreLocation" - AC_DEFINE([ENABLE_CORELOCATION], 1, - [Define to 1 to enable CoreLocation provider]) - AC_MSG_RESULT([yes]) - enable_corelocation=yes - ], [ - AC_MSG_RESULT([missing dependencies]) - AS_IF([test "x$enable_corelocation" = xyes], [ - AC_MSG_ERROR([missing CoreLocation headers]) - ]) - enable_corelocation=no - ]) -], [ - AC_MSG_RESULT([no]) - enable_corelocation=no -]) -AM_CONDITIONAL([ENABLE_CORELOCATION], [test "x$enable_corelocation" = xyes]) -AC_SUBST([CORELOCATION_CFLAGS]) -AC_SUBST([CORELOCATION_LIBS]) - - -# Check for GUI status icon -AC_MSG_CHECKING([whether to enable GUI status icon]) -AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], - [enable GUI status icon])], - [enable_gui=$enableval],[enable_gui=maybe]) -AS_IF([test "x$enable_gui" != xno], [ - AS_IF([test $have_python = yes], [ - AC_MSG_RESULT([yes]) - enable_gui=yes - ], [ - AC_MSG_RESULT([missing dependencies]) - AS_IF([test "x$enable_gui" = xyes], [ - AC_MSG_ERROR([GUI status icon script requires Python]) - ]) - enable_gui=no - ]) -], [ - AC_MSG_RESULT([no]) - enable_gui=no -]) -AM_CONDITIONAL([ENABLE_GUI], [test "x$enable_gui" != xno]) - -# Check for Ubuntu icons -AC_MSG_CHECKING([whether to enable Ubuntu icons]) -AC_ARG_ENABLE([ubuntu], [AC_HELP_STRING([--enable-ubuntu], - [enable Ubuntu icons])], - [enable_ubuntu=$enableval],[enable_ubuntu=no]) -AS_IF([test "x$enable_ubuntu" != xno], [ - AC_MSG_RESULT([yes]) -], [ - AC_MSG_RESULT([no]) -]) -AM_CONDITIONAL([ENABLE_UBUNTU], [test "x$enable_ubuntu" != xno]) - - -# Check for systemd -PKG_PROG_PKG_CONFIG -AC_MSG_CHECKING([Directory to install systemd user unit files]) -AC_ARG_WITH([systemduserunitdir], - [AS_HELP_STRING([--with-systemduserunitdir=], - [Directory for systemd user unit files])], - [], [with_systemduserunitdir=$($PKG_CONFIG --variable=systemduserunitdir systemd)]) -AS_IF([test -n "$with_systemduserunitdir" -a "x$with_systemduserunitdir" != xno], [ - AC_SUBST([systemduserunitdir], [$with_systemduserunitdir]) - AC_MSG_RESULT([$systemduserunitdir]) - enable_systemd=yes -], [ - AC_MSG_RESULT([not enabled]) - enable_systemd=no -]) -AM_CONDITIONAL([ENABLE_SYSTEMD], [test "x$enable_systemd" != xno]) - - -# Check for AppArmor -AC_MSG_CHECKING([whether to enable AppArmor profile]) -AC_ARG_ENABLE([apparmor], [AC_HELP_STRING([--enable-apparmor], - [enable AppArmor profile])], - [enable_apparmor=$enableval],[enable_apparmor=no]) -AS_IF([test "x$enable_apparmor" != xno], [ - AC_MSG_RESULT([yes]) - enable_apparmor=yes -], [ - AC_MSG_RESULT([no]) - enable_apparmor=no -]) -AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" != xno]) - - -# Checks for header files. -AC_CHECK_HEADERS([locale.h stdint.h stdlib.h string.h unistd.h signal.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_UINT16_T - -# Checks for library functions. -AC_SEARCH_LIBS([clock_gettime], [rt]) -AC_SEARCH_LIBS([floor], [m]) -AC_CHECK_FUNCS([setlocale strchr floor pow]) - -AC_CONFIG_FILES([ - Makefile - po/Makefile.in - src/Makefile - src/redshift-gtk/Makefile -]) -AC_OUTPUT - - -echo " - $PACKAGE_NAME $VERSION - - prefix: ${prefix} - compiler: ${CC} - cflags: ${CFLAGS} - ldflags: ${LDFLAGS} - - Adjustment methods: - DRM: ${enable_drm} - RANDR: ${enable_randr} - VidMode: ${enable_vidmode} - Quartz (macOS): ${enable_quartz} - WinGDI (Windows): ${enable_wingdi} - - Location providers: - Geoclue2: ${enable_geoclue2} - CoreLocation (macOS): ${enable_corelocation} - - GUI: ${enable_gui} - Ubuntu icons: ${enable_ubuntu} - systemd units: ${enable_systemd} ${systemduserunitdir} - AppArmor profile: ${enable_apparmor} -" diff --git a/contrib/redshift.spec b/contrib/redshift.spec index 475aa66b..62d3500a 100644 --- a/contrib/redshift.spec +++ b/contrib/redshift.spec @@ -6,6 +6,7 @@ Group: Applications/System License: GPLv3+ URL: http://jonls.dk/redshift/ Source0: http://launchpad.net/redshift/trunk/%{version}/+download/%{name}-%{version}.tar.xz +BuildRequires: meson BuildRequires: gettext-devel BuildRequires: libX11-devel BuildRequires: libXxf86vm-devel @@ -44,12 +45,12 @@ temperature adjustment program. %setup -q %build -%configure --enable-gui --disable-geoclue --enable-geoclue2 --enable-randr --enable-vidmode --with-systemduserunitdir=%{_userunitdir} -make %{?_smp_mflags} V=1 +%meson -Dgui=enabled -Dgeoclue2=enabled -Drandr=enabled -Dvidmode=enabled -Dsystemduserunitdir=%{_userunitdir} +%meson_build %install rm -rf %{buildroot} -make DESTDIR=%{buildroot} install INSTALL="install -p" +%meson_install %find_lang %{name} desktop-file-validate %{buildroot}%{_datadir}/applications/redshift.desktop desktop-file-validate %{buildroot}%{_datadir}/applications/redshift-gtk.desktop diff --git a/data/appdata/meson.build b/data/appdata/meson.build index 73612837..5f21c96a 100644 --- a/data/appdata/meson.build +++ b/data/appdata/meson.build @@ -1,7 +1,7 @@ if host_machine.system() != 'windows' if config_build.has('ENABLE_GUI') i18n.merge_file( - input : 'meson_redshift-gtk.appdata.xml.in', + input : 'redshift-gtk.appdata.xml.in', output : 'redshift-gtk.appdata.xml', po_dir : po_dir, install : true, diff --git a/data/appdata/meson_redshift-gtk.appdata.xml.in b/data/appdata/meson_redshift-gtk.appdata.xml.in deleted file mode 100644 index daecb25e..00000000 --- a/data/appdata/meson_redshift-gtk.appdata.xml.in +++ /dev/null @@ -1,20 +0,0 @@ - - - - redshift-gtk.desktop - CC0 - GPL-3.0+ - -

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.

-

The color temperature is set according to the position of the sun. A different color temperature is set during night and daytime. During twilight and early morning, the color temperature transitions smoothly from night to daytime temperature to allow your eyes to slowly adapt.

-

This program provides a status icon that allows the user to control Redshift.

-
- - - http://jonls.dk/assets/screenshot1.png - The Redshift information window overlaid with an example of the redness effect - - - http://jonls.dk/redshift/ - jonlst@gmail.com -
diff --git a/data/appdata/redshift-gtk.appdata.xml.in b/data/appdata/redshift-gtk.appdata.xml.in index 36399843..daecb25e 100644 --- a/data/appdata/redshift-gtk.appdata.xml.in +++ b/data/appdata/redshift-gtk.appdata.xml.in @@ -1,20 +1,20 @@ - - redshift-gtk.desktop + + redshift-gtk.desktop CC0 GPL-3.0+ - <_p>Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night. - <_p>The color temperature is set according to the position of the sun. A different color temperature is set during night and daytime. During twilight and early morning, the color temperature transitions smoothly from night to daytime temperature to allow your eyes to slowly adapt. - <_p>This program provides a status icon that allows the user to control Redshift. +

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.

+

The color temperature is set according to the position of the sun. A different color temperature is set during night and daytime. During twilight and early morning, the color temperature transitions smoothly from night to daytime temperature to allow your eyes to slowly adapt.

+

This program provides a status icon that allows the user to control Redshift.

http://jonls.dk/assets/screenshot1.png - <_caption>The Redshift information window overlaid with an example of the redness effect + The Redshift information window overlaid with an example of the redness effect http://jonls.dk/redshift/ jonlst@gmail.com -
+ diff --git a/data/applications/meson.build b/data/applications/meson.build index 32ae28d5..1bb1fce3 100644 --- a/data/applications/meson.build +++ b/data/applications/meson.build @@ -2,7 +2,7 @@ if host_machine.system() != 'windows' desktop_dir = join_paths(get_option('datadir'), 'applications') i18n.merge_file( - input : 'meson_redshift.desktop.in', + input : 'redshift.desktop.in', output : 'redshift.desktop', type : 'desktop', po_dir : po_dir, @@ -12,7 +12,7 @@ if host_machine.system() != 'windows' if config_build.has('ENABLE_GUI') i18n.merge_file( - input : 'meson_redshift-gtk.desktop.in', + input : 'redshift-gtk.desktop.in', output : 'redshift-gtk.desktop', type : 'desktop', po_dir : po_dir, diff --git a/data/applications/meson_redshift-gtk.desktop.in b/data/applications/meson_redshift-gtk.desktop.in deleted file mode 100644 index ed6a3d05..00000000 --- a/data/applications/meson_redshift-gtk.desktop.in +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=Redshift -GenericName=Color temperature adjustment -Comment=Color temperature adjustment tool -Exec=redshift-gtk -# TRANSLATORS: Icon name, please set to "redshift" -Icon=redshift -Terminal=false -Type=Application -Categories=Utility; -StartupNotify=true diff --git a/data/applications/meson_redshift.desktop.in b/data/applications/meson_redshift.desktop.in deleted file mode 100644 index c7a28e5c..00000000 --- a/data/applications/meson_redshift.desktop.in +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=Redshift -GenericName=Color temperature adjustment -Comment=Color temperature adjustment tool -Exec=redshift -# TRANSLATORS: Icon name, please set to "redshift" -Icon=redshift -Terminal=true -Type=Application -Categories=Utility; -NoDisplay=true diff --git a/data/applications/redshift-gtk.desktop.in b/data/applications/redshift-gtk.desktop.in old mode 100755 new mode 100644 index f68bef67..ed6a3d05 --- a/data/applications/redshift-gtk.desktop.in +++ b/data/applications/redshift-gtk.desktop.in @@ -1,9 +1,10 @@ [Desktop Entry] Version=1.0 -_Name=Redshift -_GenericName=Color temperature adjustment -_Comment=Color temperature adjustment tool +Name=Redshift +GenericName=Color temperature adjustment +Comment=Color temperature adjustment tool Exec=redshift-gtk +# TRANSLATORS: Icon name, please set to "redshift" Icon=redshift Terminal=false Type=Application diff --git a/data/applications/redshift.desktop.in b/data/applications/redshift.desktop.in old mode 100755 new mode 100644 index 74ca416c..c7a28e5c --- a/data/applications/redshift.desktop.in +++ b/data/applications/redshift.desktop.in @@ -1,9 +1,10 @@ [Desktop Entry] Version=1.0 -_Name=Redshift -_GenericName=Color temperature adjustment -_Comment=Color temperature adjustment tool +Name=Redshift +GenericName=Color temperature adjustment +Comment=Color temperature adjustment tool Exec=redshift +# TRANSLATORS: Icon name, please set to "redshift" Icon=redshift Terminal=true Type=Application diff --git a/po/Makevars b/po/Makevars deleted file mode 100644 index 33980f1b..00000000 --- a/po/Makevars +++ /dev/null @@ -1,41 +0,0 @@ -# Makefile variables for PO directory in any package using GNU gettext. - -# Usually the message domain is the same as the package name. -DOMAIN = $(PACKAGE) - -# These two variables depend on the location of this directory. -subdir = po -top_builddir = .. - -# These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --add-comments=TRANSLATORS - -# This is the copyright holder that gets inserted into the header of the -# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding -# package. (Note that the msgstr strings, extracted from the package's -# sources, belong to the copyright holder of the package.) Translators are -# expected to transfer the copyright for their translations to this person -# or entity, or to disclaim their copyright. The empty string stands for -# the public domain; in this case the translators are expected to disclaim -# their copyright. -COPYRIGHT_HOLDER = Jon Lund Steffensen - -# This is the email address or URL to which the translators shall report -# bugs in the untranslated strings: -# - Strings which are not entire sentences, see the maintainer guidelines -# in the GNU gettext documentation, section 'Preparing Strings'. -# - Strings which use unclear terms or require additional context to be -# understood. -# - Strings which make invalid assumptions about notation of date, time or -# money. -# - Pluralisation problems. -# - Incorrect English spelling. -# - Incorrect formatting. -# It can be your email address, or a mailing list address where translators -# can write to without being subscribed, or the URL of a web page through -# which the translators can contact you. -MSGID_BUGS_ADDRESS = https://github.com/jonls/redshift/issues - -# This is the list of locale categories, beyond LC_MESSAGES, for which the -# message catalogs shall be used. It is usually empty. -EXTRA_LOCALE_CATEGORIES = diff --git a/po/POTFILES.in b/po/POTFILES similarity index 100% rename from po/POTFILES.in rename to po/POTFILES diff --git a/po/meson.build b/po/meson.build index c6bf7353..416a338f 100644 --- a/po/meson.build +++ b/po/meson.build @@ -1,5 +1 @@ -# TODO: Remove the script when dropping autotools-based build system -# in the future. -meson.add_postconf_script('meson_gen_potfiles.py') - i18n.gettext(proj_name, preset : 'glib') diff --git a/po/meson_gen_potfiles.py b/po/meson_gen_potfiles.py deleted file mode 100755 index 9ea8a967..00000000 --- a/po/meson_gen_potfiles.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python3 - -# This script generates POTFILES for Meson from POTFILES.in for intltool - -import os - -print('Generating POTFILES for Meson...') -po_dir = os.path.dirname(__file__) -infile = os.path.join(po_dir, 'POTFILES.in') -outfile = os.path.join(po_dir, 'POTFILES') -with open(infile, 'r') as f_in: - with open(outfile, 'w') as f_out: - for l in f_in: - if l.startswith('data/'): - idx_last_sep = l.rindex('/') - f_out.write('{}meson_{}'.format( - l[:idx_last_sep + 1], l[idx_last_sep + 1:])) - else: - f_out.write(l) diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 7cac300e..00000000 --- a/src/Makefile.am +++ /dev/null @@ -1,105 +0,0 @@ - -SUBDIRS = redshift-gtk - -# I18n -localedir = $(datadir)/locale -AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" - -# redshift Program -bin_PROGRAMS = redshift - -redshift_SOURCES = \ - colorramp.c colorramp.h \ - config-ini.c config-ini.h \ - gamma-dummy.c gamma-dummy.h \ - hooks.c hooks.h \ - location-manual.c location-manual.h \ - options.c options.h \ - pipeutils.c pipeutils.h \ - redshift.c redshift.h \ - signals.c signals.h \ - solar.c solar.h \ - systemtime.c systemtime.h - -EXTRA_redshift_SOURCES = \ - gamma-drm.c gamma-drm.h \ - gamma-randr.c gamma-randr.h \ - gamma-vidmode.c gamma-vidmode.h \ - gamma-quartz.c gamma-quartz.h \ - gamma-w32gdi.c gamma-w32gdi.h \ - location-geoclue2.c location-geoclue2.h \ - location-corelocation.m location-corelocation.h \ - windows/appicon.rc \ - windows/versioninfo.rc - -AM_CFLAGS = -redshift_LDADD = @LIBINTL@ -EXTRA_DIST = windows/redshift.ico meson.build - -if ENABLE_DRM -redshift_SOURCES += gamma-drm.c gamma-drm.h -AM_CFLAGS += $(DRM_CFLAGS) -redshift_LDADD += \ - $(DRM_LIBS) $(DRM_CFLAGS) -endif - -if ENABLE_RANDR -redshift_SOURCES += gamma-randr.c gamma-randr.h -AM_CFLAGS += $(XCB_CFLAGS) $(XCB_RANDR_CFLAGS) -redshift_LDADD += \ - $(XCB_LIBS) $(XCB_CFLAGS) \ - $(XCB_RANDR_LIBS) $(XCB_RANDR_CFLAGS) -endif - -if ENABLE_VIDMODE -redshift_SOURCES += gamma-vidmode.c gamma-vidmode.h -AM_CFLAGS += $(X11_CFLAGS) $(XF86VM_CFLAGS) -redshift_LDADD += \ - $(X11_LIBS) $(X11_CFLAGS) \ - $(XF86VM_LIBS) $(XF86VM_CFLAGS) -endif - -if ENABLE_QUARTZ -redshift_SOURCES += gamma-quartz.c gamma-quartz.h -AM_CFLAGS += $(QUARTZ_CFLAGS) -redshift_LDADD += \ - $(QUARTZ_LIBS) $(QUARTZ_CFLAGS) -endif - -if ENABLE_WINGDI -redshift_SOURCES += gamma-w32gdi.c gamma-w32gdi.h -redshift_LDADD += -lgdi32 -endif - - -if ENABLE_GEOCLUE2 -redshift_SOURCES += location-geoclue2.c location-geoclue2.h -AM_CFLAGS += \ - $(GEOCLUE2_CFLAGS) -redshift_LDADD += \ - $(GEOCLUE2_LIBS) $(GEOCLUE2_CFLAGS) -endif - -# Build CoreLocation module as a separate convenience -# library since it is using a separate compiler -# (Objective C). - -if ENABLE_CORELOCATION -noinst_LTLIBRARIES = liblocation-corelocation.la -liblocation_corelocation_la_SOURCES = \ - location-corelocation.m location-corelocation.h -liblocation_corelocation_la_OBJCFLAGS = \ - $(CORELOCATION_CFLAGS) -liblocation_corelocation_la_LIBADD = \ - $(CORELOCATION_CFLAGS) $(CORELOCATION_LIBS) -redshift_LDADD += liblocation-corelocation.la -endif - - -# Windows resources -if ENABLE_WINDOWS_RESOURCE -redshift_SOURCES += windows/appicon.rc windows/versioninfo.rc -endif - -.rc.o: - $(AM_V_GEN)$(WINDRES) -I$(top_builddir) -i $< -o $@ diff --git a/src/redshift-gtk/Makefile.am b/src/redshift-gtk/Makefile.am deleted file mode 100644 index 56778af6..00000000 --- a/src/redshift-gtk/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ - -if ENABLE_GUI -redshift_gtk_PYTHON = \ - __init__.py \ - controller.py \ - statusicon.py \ - utils.py -nodist_redshift_gtk_PYTHON = \ - defs.py -redshift_gtkdir = $(pythondir)/redshift_gtk - -bin_SCRIPTS = redshift-gtk -endif - -EXTRA_DIST = defs.py.in redshift-gtk.in meson_compile_py.py meson.build -CLEANFILES = defs.py redshift-gtk - - -# Local python definitions -defs.py: defs.py.in - $(AM_V_GEN)sed -e "s|\@bindir\@|$(bindir)|g" \ - -e "s|\@localedir\@|$(localedir)|g" $< > $@ - -redshift-gtk: redshift-gtk.in - $(AM_V_GEN)sed -e "s|\@pythondir\@|$(pythondir)|g" $< > $@ From 92a6e7758436ece6723ef9382d9f8b56e30fb5ce Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Mon, 22 Oct 2018 23:28:43 +0900 Subject: [PATCH 03/19] Meson: Fix RPM build errors (redshift.spec) --- contrib/redshift.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/redshift.spec b/contrib/redshift.spec index 62d3500a..1c7c12cc 100644 --- a/contrib/redshift.spec +++ b/contrib/redshift.spec @@ -30,6 +30,7 @@ This package provides the base program. %package -n %{name}-gtk Summary: GTK integration for Redshift Group: Applications/System +BuildArch: noarch BuildRequires: python3-devel >= 3.2 BuildRequires: desktop-file-utils Requires: python3-gobject @@ -45,12 +46,16 @@ temperature adjustment program. %setup -q %build -%meson -Dgui=enabled -Dgeoclue2=enabled -Drandr=enabled -Dvidmode=enabled -Dsystemduserunitdir=%{_userunitdir} +# This macro adds "--auto-features=enabled" option and +# tries to enable all features in "meson_options.txt". +%meson -Dquartz=disabled -Dcorelocation=disabled -Dwingdi=disabled -Dsystemduserunitdir=%{_userunitdir} %meson_build %install rm -rf %{buildroot} %meson_install +# Some files are incorrectly installed into "/usr/lib64/python3.X" on x86_64. +find %{buildroot}/usr/lib64 -name "*.py*" -exec mv {} %{buildroot}/usr/lib/python*/*/*/ \; %find_lang %{name} desktop-file-validate %{buildroot}%{_datadir}/applications/redshift.desktop desktop-file-validate %{buildroot}%{_datadir}/applications/redshift-gtk.desktop From 57d579cb68a3207dc64cbf99f6470e58075328b2 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Thu, 3 Jan 2019 15:37:44 +0900 Subject: [PATCH 04/19] Meson: Use version 0.49.0 Meson 0.49.0 is already tested. --- .travis.yml | 7 ++----- appveyor.yml | 4 ++-- meson.build | 16 ++++------------ 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index df7640d4..1ca4ef14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,9 +78,8 @@ install: # Note: Python 3.6 is available without additional download. export PATH=~/virtualenv/python3.6/bin:~/.local/bin:$PATH fi - # Note: Meson 0.48.0 prints target name related warnings. - # (already fixed upstream but no release yet) - - pip3 install meson==0.47.2 + # This version of Meson is already tested. + - pip3 install meson==0.49.0 before_script: - | @@ -107,8 +106,6 @@ before_script: script: - meson $CONF_FLAGS _build - ninja -v -C _build install - # Note: "test" and "dist" fail with Meson 0.48.0. - # (already fixed upstream, will be fixed in next release) - ninja -v -C _build test - ninja -v -C _build dist # redshift tests diff --git a/appveyor.yml b/appveyor.yml index 5c6c221d..b9081c92 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,8 +14,8 @@ build: install: - ps: | Start-FileDownload "https://raw.githubusercontent.com/mesonbuild/cidata/e5ea5b021d8144515a1b8f576cda327e45a81235/ninja.exe" - # Use working versions of Meson -- pip3 install meson==0.47.2 + # This version of Meson is already tested. +- pip3 install meson==0.49.0 before_build: - ps: | diff --git a/meson.build b/meson.build index c85aa77a..a09c3395 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,7 @@ project( 'c', default_options : ['buildtype=debugoptimized', 'c_std=gnu99'], license : 'GPL3+', - meson_version : '>= 0.47', + meson_version : '>= 0.49', version : '1.12', ) proj_name = meson.project_name() @@ -152,18 +152,10 @@ if foundation_dep.found() and cocoa_dep.found() endif # Check for GUI status icon -# TODO: Pass "get_option('gui')" to "required" kwarg -# and set meson_version in project() to ">= 0.48". -# Note that there are some regressions in 0.48.0 and -# we currently cannot switch to 0.48.0. See .travis.yml. pymod = import('python') -opt_gui = get_option('gui') -if not opt_gui.disabled() - py_installation = pymod.find_installation( - 'python3', required : opt_gui.enabled()) - if py_installation.found() - config_build.set('ENABLE_GUI', 1) - endif +py_installation = pymod.find_installation('python3', required : get_option('gui')) +if py_installation.found() + config_build.set('ENABLE_GUI', 1) endif # Check for Ubuntu icons From bb98257562d91325f2516187290a66ebcc3aef61 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Mon, 25 Feb 2019 21:54:32 +0900 Subject: [PATCH 05/19] Meson: Fix potential build issue when compiling "redshift.c" --- src/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/src/meson.build b/src/meson.build index 3bbfae27..22ab8ce7 100644 --- a/src/meson.build +++ b/src/meson.build @@ -90,6 +90,7 @@ redshift_libs += libredshift_common executable('redshift', redshift_sources, + dependencies : redshift_deps, include_directories : include_dirs, link_with : redshift_libs, install : true, From 6b2fa5b0ca7a8737cf224adf31944e6e2249b114 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Mon, 25 Feb 2019 22:01:46 +0900 Subject: [PATCH 06/19] Meson: Get rid of intltool-related files from .gitignore --- .gitignore | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.gitignore b/.gitignore index ecb33983..8ed74fc7 100644 --- a/.gitignore +++ b/.gitignore @@ -72,18 +72,3 @@ dkms.conf /src/redshift-gtk/defs.py /src/redshift-gtk/redshift-gtk /src/redshift-gtk/__pycache__/ - -# gettext -/po/POTFILES -/po/stamp-po -/po/stamp-it -/po/*.gmo -/po/Makefile.in.in -/po/Rules-quot -/po/boldquot.sed -/po/Makevars.template -/po/en@boldquot.header -/po/en@quot.header -/po/insert-header.sin -/po/quot.sed -/po/remove-potcdate.sin From a6067144884f4895edfa1b6092081928d26d3019 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Tue, 26 Feb 2019 23:05:25 +0900 Subject: [PATCH 07/19] Meson: Use Ubuntu Xenial in .travis.yml --- .travis.yml | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1ca4ef14..57ed52cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ sudo: required matrix: include: - os: linux + dist: xenial compiler: gcc - os: osx compiler: clang @@ -23,6 +24,8 @@ addons: - libxxf86vm-dev # GeoClue2 - libglib2.0-dev + # Meson + - ninja-build install: - | @@ -43,40 +46,8 @@ install: fi - | if [ "$TRAVIS_OS_NAME" == "linux" ]; then - # We need to use newer versions of Ninja and gettext to - # get Meson to work on Ubuntu 14.04 LTS (Trusty). - - # Ninja: From official GitHub repo, smaller than other versions - ninja_url=https://github.com/ninja-build/ninja/releases/download/v1.5.3/ninja-linux.zip - wget -O - "$ninja_url" | funzip > ninja - sudo install -m 755 ninja /usr/bin - - # gettext and its dependencies: From Ubuntu 18.04 LTS (Bionic) mirror - # * Only msgfmt and xgettext need to be upgraded to 0.19.7+. - # * appdata.{its,loc} are needed too. - gettext_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/g/gettext/gettext_0.19.8.1-6_amd64.deb - libtinfo_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1_amd64.deb - libunistring_url=http://us-central1.gce.archive.ubuntu.com/ubuntu/pool/main/libu/libunistring/libunistring2_0.9.9-0ubuntu1_amd64.deb - for url in "$gettext_url" "$libtinfo_url" "$libunistring_url"; do - wget "$url" - done - ar p gettext*.deb data.tar.xz > gettext.tar.xz - ar p libtinfo*.deb data.tar.xz > libtinfo.tar.xz - ar p libunistring*.deb data.tar.xz > libunistring.tar.xz - cmd="tar -C / -Jxf gettext.tar.xz" - cmd="$cmd ./usr/bin/msgfmt" - cmd="$cmd ./usr/bin/xgettext" - cmd="$cmd ./usr/lib/x86_64-linux-gnu/libgettext{lib,src}{,-0.19.8.1}.so" - cmd="$cmd ./usr/share/gettext-0.19.8/its/appdata.{its,loc} &&" - cmd="$cmd tar -C / -Jxf libtinfo.tar.xz" - cmd="$cmd ./lib/x86_64-linux-gnu/libtinfo.so.5{.9,} &&" - cmd="$cmd tar -C / -Jxf libunistring.tar.xz" - cmd="$cmd ./usr/lib/x86_64-linux-gnu/libunistring.so.2{.1.0,}" - sudo bash -c "$cmd" - - # Set PATH to use Python 3.6 and Meson - # Note: Python 3.6 is available without additional download. - export PATH=~/virtualenv/python3.6/bin:~/.local/bin:$PATH + # Set PATH to use Python 3.7 (already installed) and Meson + export PATH=~/virtualenv/python3.7/bin:~/.local/bin:$PATH fi # This version of Meson is already tested. - pip3 install meson==0.49.0 @@ -90,6 +61,7 @@ before_script: CONF_FLAGS="$CONF_FLAGS -Dwingdi=disabled -Dgeoclue2=enabled" CONF_FLAGS="$CONF_FLAGS -Dcorelocation=disabled -Dgui=enabled" CONF_FLAGS="$CONF_FLAGS -Dubuntu=disabled -Dapparmor=enabled" + CONF_FLAGS="$CONF_FLAGS -Dsystemduserunitdir=$TRAVIS_BUILD_DIR/root/lib/systemd/user" export CONF_FLAGS fi - | From 2e4d0d25195458c8dbca1418a6cc73a89a779dc1 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Tue, 26 Feb 2019 23:06:18 +0900 Subject: [PATCH 08/19] Meson: Use Meson 0.49.2 --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57ed52cc..d75e2e25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ install: export PATH=~/virtualenv/python3.7/bin:~/.local/bin:$PATH fi # This version of Meson is already tested. - - pip3 install meson==0.49.0 + - pip3 install meson==0.49.2 before_script: - | diff --git a/appveyor.yml b/appveyor.yml index b9081c92..f290bf20 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ install: - ps: | Start-FileDownload "https://raw.githubusercontent.com/mesonbuild/cidata/e5ea5b021d8144515a1b8f576cda327e45a81235/ninja.exe" # This version of Meson is already tested. -- pip3 install meson==0.49.0 +- pip3 install meson==0.49.2 before_build: - ps: | From af9561c7bf57bc2e0313be98a1264a299722a82e Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Wed, 27 Feb 2019 22:11:57 +0900 Subject: [PATCH 09/19] Meson: Don't add unused PATH ~/.local/bin in .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d75e2e25..d497a9dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ install: - | if [ "$TRAVIS_OS_NAME" == "linux" ]; then # Set PATH to use Python 3.7 (already installed) and Meson - export PATH=~/virtualenv/python3.7/bin:~/.local/bin:$PATH + export PATH=~/virtualenv/python3.7/bin:$PATH fi # This version of Meson is already tested. - pip3 install meson==0.49.2 From cc3860b19757a140db4e1bbacb1fdae0ad78aacf Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Wed, 27 Feb 2019 22:58:11 +0900 Subject: [PATCH 10/19] Meson: We don't need to use sudo in .travis.yml --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d497a9dd..efce6107 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ language: c -sudo: required - matrix: include: - os: linux From b03b3b63fe8bf38127843ffaf10738be98146397 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 19 Apr 2020 22:32:11 +0900 Subject: [PATCH 11/19] Meson: Use "/" instead of join_paths() Supported since 0.49. Required Meson version is unchanged. --- data/apparmor/meson.build | 5 +++-- data/appdata/meson.build | 2 +- data/applications/meson.build | 2 +- data/meson.build | 8 ++++---- meson.build | 6 +++--- src/redshift-gtk/meson.build | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/data/apparmor/meson.build b/data/apparmor/meson.build index 84f2ea32..6049b822 100644 --- a/data/apparmor/meson.build +++ b/data/apparmor/meson.build @@ -4,7 +4,8 @@ if config_build.has('ENABLE_APPARMOR') output : 'usr.bin.redshift', configuration : in_substs, ) - install_data(usr_bin_redshift, - install_dir : join_paths(get_option('sysconfdir'), 'apparmor.d'), + install_data( + usr_bin_redshift, + install_dir : get_option('sysconfdir') / 'apparmor.d', ) endif diff --git a/data/appdata/meson.build b/data/appdata/meson.build index 5f21c96a..2ffa6eb6 100644 --- a/data/appdata/meson.build +++ b/data/appdata/meson.build @@ -5,7 +5,7 @@ if host_machine.system() != 'windows' output : 'redshift-gtk.appdata.xml', po_dir : po_dir, install : true, - install_dir : join_paths(get_option('datadir'), 'appdata'), + install_dir : get_option('datadir') / 'appdata', ) endif endif diff --git a/data/applications/meson.build b/data/applications/meson.build index 1bb1fce3..7973a7a1 100644 --- a/data/applications/meson.build +++ b/data/applications/meson.build @@ -1,5 +1,5 @@ if host_machine.system() != 'windows' - desktop_dir = join_paths(get_option('datadir'), 'applications') + desktop_dir = get_option('datadir') / 'applications' i18n.merge_file( input : 'redshift.desktop.in', diff --git a/data/meson.build b/data/meson.build index 02f14f6d..33b99722 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,11 +1,11 @@ # Icons -icons_dir = join_paths(get_option('datadir'), 'icons') -install_subdir(join_paths('icons', 'hicolor'), install_dir : icons_dir) +icons_dir = get_option('datadir') / 'icons' +install_subdir('icons' / 'hicolor', install_dir : icons_dir) if config_build.has('ENABLE_UBUNTU') install_subdir( - join_paths('icons', 'ubuntu-mono-dark'), install_dir : icons_dir) + 'icons' / 'ubuntu-mono-dark', install_dir : icons_dir) install_subdir( - join_paths('icons', 'ubuntu-mono-light'), install_dir : icons_dir) + 'icons' / 'ubuntu-mono-light', install_dir : icons_dir) endif subdir('apparmor') diff --git a/meson.build b/meson.build index a09c3395..08b5ada8 100644 --- a/meson.build +++ b/meson.build @@ -19,9 +19,9 @@ endif cc = meson.get_compiler('c') # Directories -full_bindir = join_paths(get_option('prefix'), get_option('bindir')) -full_localedir = join_paths(get_option('prefix'), get_option('localedir')) -po_dir = join_paths(meson.source_root(), 'po') +full_bindir = get_option('prefix') / get_option('bindir') +full_localedir = get_option('prefix') / get_option('localedir') +po_dir = meson.source_root() / 'po' in_substs = configuration_data() in_substs.set('bindir', full_bindir) in_substs.set('localedir', full_localedir) diff --git a/src/redshift-gtk/meson.build b/src/redshift-gtk/meson.build index fcdbf478..892729ff 100644 --- a/src/redshift-gtk/meson.build +++ b/src/redshift-gtk/meson.build @@ -1,5 +1,5 @@ if config_build.has('ENABLE_GUI') - py_installdir = join_paths(py_installation.get_install_dir(), 'redshift_gtk') + py_installdir = py_installation.get_install_dir() / 'redshift_gtk' in_substs.set('pythondir', py_installdir) defs_py = configure_file( From 12943e878aeae8d834fcb8ffa8e6db1df195a442 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 14 Jun 2020 13:33:59 +0900 Subject: [PATCH 12/19] Travis: Remove "brew upgrade python" --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index efce6107..9b8eb3bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,8 +39,6 @@ install: # we install it via pip to pin its version. # Meson uses Ninja and we install it via brew. brew install ninja - # Note: No longer needed. Errors can be ignored. - brew upgrade python || true fi - | if [ "$TRAVIS_OS_NAME" == "linux" ]; then From 3ea6d0823e885a7c034f5fafe80653ba0a480158 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 14 Jun 2020 14:35:36 +0900 Subject: [PATCH 13/19] Meson: Set PATH to use gettext on macOS in .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9b8eb3bb..5d54c08b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,13 +32,13 @@ install: # we can install needed packages with HOMEBREW_NO_AUTO_UPDATE=1. # This reduces job time significantly. brew update - brew install gettext - brew link --force gettext # Building with Meson sometimes fails due to its regressions. # Meson can be installed via brew, but # we install it via pip to pin its version. # Meson uses Ninja and we install it via brew. brew install ninja + # Enable gettext + export PATH=/usr/local/opt/gettext/bin:$PATH fi - | if [ "$TRAVIS_OS_NAME" == "linux" ]; then From 7b78aa16451ff5381688806b9a625d269ae1c9bd Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 14 Jun 2020 14:41:56 +0900 Subject: [PATCH 14/19] Meson: Use Meson 0.54.2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5d54c08b..cf7295a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ install: export PATH=~/virtualenv/python3.7/bin:$PATH fi # This version of Meson is already tested. - - pip3 install meson==0.49.2 + - pip3 install meson==0.54.2 before_script: - | From 4a8fbf344bde9ddb19c3df39b81385a190c627f8 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 14 Jun 2020 15:05:56 +0900 Subject: [PATCH 15/19] Meson: Install Ninja from PyPI in .travis.yml --- .travis.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf7295a7..b1298fbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,21 +22,10 @@ addons: - libxxf86vm-dev # GeoClue2 - libglib2.0-dev - # Meson - - ninja-build install: - | if [ "$TRAVIS_OS_NAME" == "osx" ]; then - # Note: "brew update" and "brew install gettext" are not necessary and - # we can install needed packages with HOMEBREW_NO_AUTO_UPDATE=1. - # This reduces job time significantly. - brew update - # Building with Meson sometimes fails due to its regressions. - # Meson can be installed via brew, but - # we install it via pip to pin its version. - # Meson uses Ninja and we install it via brew. - brew install ninja # Enable gettext export PATH=/usr/local/opt/gettext/bin:$PATH fi @@ -46,7 +35,7 @@ install: export PATH=~/virtualenv/python3.7/bin:$PATH fi # This version of Meson is already tested. - - pip3 install meson==0.54.2 + - pip3 install ninja meson==0.54.2 before_script: - | From 376fca1ec5b3cdc8e9e8330270df2d88944e7bac Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 14 Jun 2020 21:55:19 +0900 Subject: [PATCH 16/19] Meson: Change Meson version and install ninja via pip in appveyor.yml --- appveyor.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f290bf20..63798bba 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,10 +12,8 @@ build: verbosity: detailed install: -- ps: | - Start-FileDownload "https://raw.githubusercontent.com/mesonbuild/cidata/e5ea5b021d8144515a1b8f576cda327e45a81235/ninja.exe" # This version of Meson is already tested. -- pip3 install meson==0.49.2 +- pip3 install ninja meson==0.54.2 before_build: - ps: | From a2efc3d4cde5511b02ce28c0b9b73551802b6f25 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 14 Jun 2020 22:16:41 +0900 Subject: [PATCH 17/19] Revert "Meson: Change Meson version and install ninja via pip in appveyor.yml" This reverts commit 376fca1ec5b3cdc8e9e8330270df2d88944e7bac. --- appveyor.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 63798bba..f290bf20 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,8 +12,10 @@ build: verbosity: detailed install: +- ps: | + Start-FileDownload "https://raw.githubusercontent.com/mesonbuild/cidata/e5ea5b021d8144515a1b8f576cda327e45a81235/ninja.exe" # This version of Meson is already tested. -- pip3 install ninja meson==0.54.2 +- pip3 install meson==0.49.2 before_build: - ps: | From d4e7adefdacd550da513d2d90dc0ee5bcec7e90c Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 14 Jun 2020 22:18:37 +0900 Subject: [PATCH 18/19] Meson: Use Meson 0.54.2 in appveyor.yml --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f290bf20..73f5b61d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ install: - ps: | Start-FileDownload "https://raw.githubusercontent.com/mesonbuild/cidata/e5ea5b021d8144515a1b8f576cda327e45a81235/ninja.exe" # This version of Meson is already tested. -- pip3 install meson==0.49.2 +- pip3 install meson==0.54.2 before_build: - ps: | From 7e6d22e549d83074e850eb12df4e66ef12c68870 Mon Sep 17 00:00:00 2001 From: Masanori Kakura Date: Sun, 25 Oct 2020 12:04:31 +0900 Subject: [PATCH 19/19] Meson: Use summary() instead of message() Supported since 0.53.0. --- meson.build | 67 ++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/meson.build b/meson.build index 08b5ada8..1f3c42f4 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,7 @@ project( 'c', default_options : ['buildtype=debugoptimized', 'c_std=gnu99'], license : 'GPL3+', - meson_version : '>= 0.49', + meson_version : '>= 0.53', version : '1.12', ) proj_name = meson.project_name() @@ -203,34 +203,37 @@ subdir('data') # Generate config.h configure_file(output : 'config.h', configuration : config_h) -message('''@0@ @1@ - prefix: @2@ - - Adjustment methods: - DRM: @3@ - RANDR: @4@ - VidMode: @5@ - Quartz (macOS): @6@ - WinGDI (Windows): @7@ - - Location providers: - Geoclue2: @8@ - CoreLocation (macOS): @9@ - - GUI: @10@ - Ubuntu icons: @11@ - systemd units: @12@ @13@ - AppArmor profile: @14@ -'''.format(proj_name, proj_version, get_option('prefix'), - config_h.has('ENABLE_DRM') ? 'yes' : 'no', - config_h.has('ENABLE_RANDR') ? 'yes' : 'no', - config_h.has('ENABLE_VIDMODE') ? 'yes' : 'no', - config_h.has('ENABLE_QUARTZ') ? 'yes' : 'no', - config_h.has('ENABLE_WINGDI') ? 'yes' : 'no', - config_h.has('ENABLE_GEOCLUE2') ? 'yes' : 'no', - config_h.has('ENABLE_CORELOCATION') ? 'yes' : 'no', - config_build.has('ENABLE_GUI') ? 'yes' : 'no', - config_build.has('ENABLE_UBUNTU') ? 'yes' : 'no', - config_build.has('ENABLE_SYSTEMD') ? 'yes' : 'no', systemd_userunitdir, - config_build.has('ENABLE_APPARMOR') ? 'yes' : 'no', -)) +# Summary +summary( + { + 'prefix': get_option('prefix'), + }, + section: 'Directories', +) +summary( + { + 'DRM': config_h.has('ENABLE_DRM'), + 'RANDR': config_h.has('ENABLE_RANDR'), + 'VidMode': config_h.has('ENABLE_VIDMODE'), + 'Quartz (macOS)': config_h.has('ENABLE_QUARTZ'), + 'WinGDI (Windows)': config_h.has('ENABLE_WINGDI'), + }, + section: 'Adjustment methods', +) +summary( + { + 'Geoclue2': config_h.has('ENABLE_GEOCLUE2'), + 'CoreLocation (macOS)': config_h.has('ENABLE_CORELOCATION'), + }, + section: 'Location providers', +) +summary( + { + 'GUI': config_build.has('ENABLE_GUI'), + 'Ubuntu icons': config_build.has('ENABLE_UBUNTU'), + 'systemd units': config_build.has('ENABLE_SYSTEMD') + ? systemd_userunitdir : 'None', + 'AppArmor profile': config_build.has('ENABLE_APPARMOR'), + }, + section: 'Miscellaneous', +)