Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meson: Add support for Meson build system #675

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,79 +54,21 @@ 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
/data/applications/redshift.desktop
/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
/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/[email protected]
/po/[email protected]
/po/insert-header.sin
/po/quot.sed
/po/remove-potcdate.sin
59 changes: 38 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ language: c
matrix:
include:
- os: linux
dist: xenial
compiler: gcc
dist: trusty
sudo: false
- os: osx
compiler: clang

addons:
apt:
packages:
- autopoint
- intltool
# DRM
- libdrm-dev
# RANDR
Expand All @@ -25,30 +22,50 @@ 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
# Enable gettext
export PATH=/usr/local/opt/gettext/bin:$PATH
fi
- |
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
# Set PATH to use Python 3.7 (already installed) and Meson
export PATH=~/virtualenv/python3.7/bin:$PATH
fi
# This version of Meson is already tested.
- pip3 install ninja meson==0.54.2

before_script:
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
CONF_FLAGS="--prefix=$TRAVIS_BUILD_DIR/root"
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"
CONF_FLAGS="$CONF_FLAGS -Dsystemduserunitdir=$TRAVIS_BUILD_DIR/root/lib/systemd/user"
export CONF_FLAGS
fi
- |
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
CONF_FLAGS="--prefix=$TRAVIS_BUILD_DIR/root"
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
- make -j2 install
- make -j2 distcheck

script:
- meson $CONF_FLAGS _build
- ninja -v -C _build install
- ninja -v -C _build test
- ninja -v -C _build dist
# redshift tests
- |
"$TRAVIS_BUILD_DIR"/root/bin/redshift -l 12:-34 -pv
- |
Expand Down
40 changes: 20 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
```


Expand Down
Loading