Commit Graph

277 Commits

Author SHA1 Message Date
Lucas Schwiderski 353ccfb0dd
Make CMake Lua executable customizable
Some platforms, such as Arch Linux, already moved to Lua 5.4, while
offering Lua 5.3 as a separate executable, such as `/usr/bin/lua5.3`.
To be able to build awesomeWM on these platforms without extensive
shims, this change introduces a new CMake variable `LUA_EXECUTABLE`.

Its default is set by `find_program` to the usual `/usr/bin/lua`,
but allows running CMake like this:

```sh
cmake ../ \
    -DLUA_INCLUDE_DIR=/usr/include/lua5.3 \
    -DLUA_LIBRARY=/usr/lib/liblua.so.5.3 \
    -DLUA_EXECUTABLE=/usr/bin/lua5.3
```
2021-03-23 09:10:03 +01:00
Emmanuel Lepage Vallee c1d59fef24 doc: Build property indexes for more classes instead of only client.
These index will be used for the rules documentation.
2020-02-15 20:33:21 -05:00
Emmanuel Lepage Vallee ee80fe052f init: Add an API level concept to `capi`.
The API level concept is something used by other projects such as
Android and iOS to allow deprecated features to be removed and the
bahavior to be altered without breaking compability with existing
code.

The same will apply to AwesomeWM. The current API level is "4" and
as long as config use this, no deprecation or bahavior change will
be exposed. If the user sets it to an higher value or we release
the next major version and new users start to use the, then current,
default config, they will use the new API level.

The the far future, if ever, we could fork the entire Lua libraries
to support legacy APIs. This would only require to keep the core
API support for those legacy calls. In the meantime, `gears.debug`
will use this to manage the deprecation and some conditional code
will be added as a last resort attempt to preserve behavior
compatibility while moving forward with breaking changes.
2020-02-08 17:18:01 -05:00
Uli Schlachter a57c79687a Use xcb-errors library if it is available
This library allows to get a human-readable string describing X11
requests, events, and errors. We now use this library to pretty-print
X11 errors if we get any.

To test this code, I added the following two lines to AwesomeWM so that
X11 errors are generated:

    xcb_set_input_focus(globalconf.connection, 42, 42, 42);
    xcb_randr_set_output_primary(globalconf.connection,
        globalconf.screen->root, 42);

Output without xcb-errors:

    X error: request=SetInputFocus (major 42, minor 0), error=BadValue (2)
    X error: request=(null) (major 140, minor 30), error=(null) (147)

Output with xcb-errors:

    X error: request=SetInputFocus (major 42, minor 0), error=Value (2)
    X error: request=RandR-SetOutputPrimary (major 140, minor 30), error=RandR-BadOutput (147)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-03-03 09:15:29 +01:00
mergify[bot] 799650d887
Merge pull request #2671 from psychon/auto_option
CMake: Add "AUTO" state for WITH_DBUS and GENERATE_MANPAGES
2019-02-19 18:50:43 +00:00
Uli Schlachter c7cdb0e479 CMake: Add "AUTO" state for WITH_DBUS and GENERATE_MANPAGES
Previously, these options had two possible values: ON and OFF.

Now, they have three possible values: ON, OFF, and AUTO.

OFF still does what it always did: The feature is just disabled.

With ON and AUTO, we check for the feature. The difference is what
happens when the feature could not be enabled, e.g. because some
dependencies is missing: With AUTO, we just disable the feature (this is
what happened previously with ON). However, with ON, CMake aborts and
prints an error.

Implements: Suggestion by Daniel
    https://github.com/awesomeWM/awesome/pull/2665#pullrequestreview-204595138
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-19 07:55:41 +01:00
Daniel Hahler ddf422dd0d
cmake: fix generate-examples/check-examples (#2545) 2019-02-19 00:15:19 +01:00
Uli Schlachter b50559e71b Remove AWESOME_IS_BIG_ENDIAN
This is unused since commit db3b1fe431 from 2010.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-18 13:55:51 +01:00
Uli Schlachter 2023ed187a Add xcb-xfixes as a new dependency and initialise it
This commit prepares changes in the following commits

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-06 09:21:26 +01:00
Emmanuel Lepage Vallee 2cb5a0f0e1 codename: Change for "Too long" 2019-01-26 13:16:21 -05:00
Emmanuel Lepage Vallee b49f7e22dd doc: Add an index of valid properties to awful.spawn and awful.rules. 2018-10-12 14:19:25 -04:00
Emmanuel Lepage Vallee 62c95d5fe6 build: Move the meta file parser to an helper module
The commit also re-work the build target so if the file are deleted,
then they are created again. Using `file(COPY ...)` and
`file(MAKE_DIRECTORY ...)` as done previously caused some file to be out
of date or not being regenerated at all.

This commit also fixes some broken target that depended on `file(` and
`configure_file` CMake command not being part of any target.

Fix #2342
2018-10-12 14:18:32 -04:00
Uli Schlachter 7db0188cb2 CMake: Use check_symbol_exists instead of check_function_exists
The documentation for the CheckFunctionExists module says that it is
better to use CheckSymbolExists and lists some reasons. For our purpose,
the reason is that check_function_exists is incompatible with -Werror.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-26 09:12:40 +02:00
Joseph Herlant d9cc56538f build: man pages: use asciidoctor instead of asciidoc (#2234) 2018-04-04 11:28:50 +02:00
Daniel Hahler 8923df4a5f build: make DO_COVERAGE a CMake variable
Travis: remove CXXFLAGS (not used), LDFLAGS (typo, not used)

Closes https://github.com/awesomeWM/awesome/pull/2001.
2017-08-29 22:24:12 +02:00
Emmanuel Lepage Vallée 2900ea6f01 Merge pull request #1842 from psychon/lgi-check
Port lgi-check.sh to C
2017-08-12 15:59:18 -04:00
Daniel Hahler a5d6f877c5 cmake: remove unused a_find_library (#1921)
The last usage was removed in ea301194.
2017-07-16 15:25:22 +02:00
Daniel Hahler 02ef4f3ce7 cmake: check (and cache) check of required modules (#1920)
This makes the CMake run much faster in general, and does not re-check
the dependencies every time again (since it gets cached).

There are several reports where the reference to the missing module was
not provided, and they all appear to have happened with CMake 3.6.1.

A missing "foobar" module gets reported there, but if you remove
/usr/lib/pkgconfig/libstartup-notification-1.0.pc, this does not get
reported:

    -- Checking for modules '…'
    --
    CMake Error at /tmp/cmake/share/cmake-3.6/Modules/FindPkgConfig.cmake:424 (message):
      A required package was not found

This apparently affects modules that have version requirements. After
removing that from "libstartup-notification-1.0>=0.10", it gets reported
also: "No package 'libstartup-notification-1.0' found".

The workaround is to require the package without version information
before the requirement with the version information.

This reverts https://github.com/awesomeWM/awesome/pull/1253.
2017-07-16 15:24:40 +02:00
Emmanuel Lepage Vallee 20dfff373d release: Change the codename 2017-07-15 15:53:13 +02:00
Uli Schlachter 95b412df19 Move project() call to CMakeLists.txt (#1909)
CMake "fakes" a call to "project(Project C CXX)" if it does not see a
project() call in CMakeLists.txt. Since we had this call in a different
file, this default applied. This meant that CMake unnecessarily required
a C++ compiler.

Fix/work-around this by moving the call to project() into CMakeLists.txt

Reference: https://github.com/awesomeWM/awesome/pull/1907#discussion_r125581273
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-07-09 16:23:56 +02:00
Daniel Hahler 4b4318602c cmake: abort if Lua was not found (#1892)
This will usually result in errors during linking, and the error message
itself is not obvious to find.
Therefore just abort in this case.
2017-07-03 11:55:20 +02:00
Uli Schlachter ddc51cf38c Port lgi-check.sh to C
Previously, the lgi check used the normal Lua interpreter to check if
lgi is installed. However, nothing ensures/requires that awesome is
built against the same Lua version as the Lua interpreter. This means
that if lgi is only available for some Lua version, then the check could
succeed even though awesome would later fail to start. Also, the check
might have failed even though awesome would not have any problems
finding lgi.

This commit replaces lgi-check.sh by a small C program which does the
same thing. This ensures that the same Lua version is used as awesome
will be using.

There are some places that still use the Lua interpreter: Example tests
(run through the Lua interpreter directly) and unit tests (run through
busted). For unit tests, this should not make much of a difference and
example tests might later get similar treatment.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-06-13 15:47:07 +02:00
Uli Schlachter 84080c64c5 spawn: Use CLOEXEC for pipes (#1811)
Fixes: https://github.com/awesomeWM/awesome/issues/1193#issuecomment-305705724
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-06-02 10:13:26 +02:00
Uli Schlachter bcf70f3740 Drop our use of iconv (#1772)
We were only using this for tag names. This means we are assuming that
everything is UTF8, but tag names are provided in the local locale and
need to be translated into UTF8? That makes no sense, so just drop this.

Fixes: https://github.com/awesomeWM/awesome/issues/1753
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-07 17:59:53 +02:00
Tomoya Tabuchi 2bb07343c6
Add iconv library detection for FreeBSD by using code for macOS.
The workaround for finding iconv on macOS is also necessary on FreeBSD,
because libiconv needs to be explicitly linked against on this platform.
2017-04-04 21:12:38 +09:00
Uli Schlachter 088584c812 change codename
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-18 10:49:46 +01:00
Emmanuel Lepage Vallee 2ddbbfb70c doc: Add the default theme to the sample files
Also add the gears to make this more flexible in the future.
2017-02-25 16:42:55 -05:00
Emmanuel Lepage Vallee b697777498 doc: Add the default rc.lua to the API documentation
Enable the `Sample files` section provided by ldoc but unused
until now.
2017-02-25 16:42:55 -05:00
Uli Schlachter 288e44596f Export build-time paths as entries on awesome
This removes some @EXPANSIONS@ from Lua files and removes a hack that
was needed. All is better now! :-)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-25 09:41:11 +01:00
Daniel Hahler 9f832b95a3 awesomeConfig.cmake: docs/06-appearance.md depends on lgi-check (#1386)
Ref: https://github.com/awesomeWM/awesome/issues/1385
2017-01-12 03:28:56 +01:00
Daniel Hahler 6aee6c2053 ci: overhaul coverage processing
- Execute the tests without compiling, and don't mess with the source
   files when coverage is enabled.
   This ensures that the coverage report lines are correct.
   This disables the doc tests, as their results would be unused.
   Hack: it still expands macros on util.lua, because of
   `util.get_themes_dir()` and `util.get_awesome_icon_dir()`, which might
   be moved later.  Ref:
   https://github.com/awesomeWM/awesome/pull/1239#discussion_r93828178.
 - ensure that BUILD_APIDOC and DO_COVERAGE are not used together
 - awesomeConfig.cmake: add DO_COVERAGE as an option
 - Travis: only install codecov with DO_COVERAGE=codecov
 - Travis: do not use set -v; use set -x with DO_COVERAGE
 - do not use trailing slashes with dirs in tests/examples/CMakeLists.txt / .luacov
 - Use latest luacov (0.12.0-1) again
   This reverts parts of 4cc6a815.
   I think it is better to fix any failure that 4cc6a815 tried to work around.
 - Travis: simplify/fix require('luacov') for functionaltests
 - tests/examples/CMakeLists.txt: resolve ../.. in SOURCE_DIR
 - tests/examples/CMakeLists.txt: add DO_COVERAGE to env
 - Cleanup/simplify .luacov: work with SOURCE_DIRECTORY alone
 - tests/run.sh: pass through / set SOURCE_DIRECTORY when running awesome
 - tests/run.sh: resolve source_dir
 - use DO_COVERAGE from env only
2017-01-08 20:34:13 +01:00
Emmanuel Lepage Vallée a1085b64dd Merge pull request #1358 from Elv13/clear_the_cache
build: Clear the cache when checking if a package is present
2017-01-04 04:45:09 -05:00
Emmanuel Lepage Vallee b26aff3cd0 build: Clear the cache when checking if a package is present
While on Gentoo I get the right error message anyway, apparently
this isn't universal.

Fix #1356
2017-01-03 15:56:58 -05:00
Daniel Hahler fdc93e68da build: use git-describe with just .git / add 'Using version from …' msg (#1302)
With Git submodules there is only a `.git` file typically, e.g.:

> gitdir: /home/user/Vcs/awesome-www/.git/modules/src
2016-12-25 23:17:54 +01:00
Emmanuel Lepage Vallee 58fed31d88 change codename 2016-12-25 22:17:14 +01:00
Emmanuel Lepage Vallee 26c0a3c2c5 cmake: Check dependencies one by one
It was currently done all at once. Therefore, the error message was:

CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:415 (message):
  A required package was not found

With no further information besides the full dependency list.

With this change, it will print the missing package.

Closes https://github.com/awesomeWM/awesome/pull/1253.
2016-12-02 21:55:36 +01:00
Uli Schlachter 8409639d4d Blacklist broken LDoc versions (#1207)
Fixes: https://github.com/awesomeWM/awesome/issues/1098
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-11-06 01:24:25 +01:00
Uli Schlachter 0e81479a3f Use xcb-util-xrm
Instead of using Xlib for parsing resource files, this now uses the
dedicated xcb-based library that is meant for exactly this task.

Fixes: https://github.com/awesomeWM/awesome/issues/1176
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-11-03 13:34:43 +01:00
Emmanuel Lepage Vallee dd959eecd6 build: Fix make install when ldoc is missing 2016-10-03 23:39:14 -04:00
Uli Schlachter 3993388c01 awesomeConfig.cmake: Stop forcing CMAKE_BUILD_TYPE
I don't know why we force CMAKE_BUILD_TYPE to be RELEASE, but I don't think we
should do that.

This also changes the default build type to something which does not contain
-DNDEBUG in CFLAGS. This means that assert()s will start to work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:36:36 +02:00
Emmanuel Lepage Vallee 63b712e247 doc: Document rc.lua
This meta-lua script takes the "raw" awesomerc.lua and turn it
into the final file and generate a documentation page from its
parsed content. It support

 * Turn {{{ into markdown categories
 * Turn top level comments into documentation
 * Add custom documentation sections
 * Parse the code to add links for each API calls

This helps generate a good entry point for new users wanting to
understand the content of rc.lua without searching the API by
hand.

Over time, this will also become the basis of the documentation.

If `rc.lua` is separated into several files, this will be easy to fix
this script. It could even do the separation itself from a monolitic
file using the already implemented {{{ parser.
2016-09-26 00:40:20 -04:00
Emmanuel Lepage Vallee 5f10e7a74e doc: Begin to document the themes better.
This add a meta-lua file that parses all existing lua files
to generate a list of all beautiful variables.
2016-09-26 00:40:19 -04:00
Uli Schlachter dc0a337aea CMake: Check if we need libm for round()
Fixes: https://github.com/awesomeWM/awesome/issues/969
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-05 22:28:33 +02:00
Uli Schlachter 2e6358ca2d Stop checking for __builtin_clz (#985)
Since commit 19137a55 we no longer use this builtin, so we don't have to check
for it anymore either.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-05 22:12:26 +02:00
Emmanuel Lepage Vallee de2d6fb521 doc: Add a system to auto-generate widgets list
This system allow containers, widgets and layouts to be listed in
the documentation with an example screenshot.

It uses raw HTML due to ldoc limitations, but as it is autogenerated,
it wont be user visible.
2016-05-30 18:00:58 -04:00
Emmanuel Lepage Vallee ac7ea4c70f tests: Fix coverage data
As the documentation generation insert increasingly large ammount
of code into the lua files, the coverage data is getting less and
less accurate. This try to fix this by only collecting such data
after the `configure_file` calls are done.
2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee 44a4eca40e doc: Port the shape images to the doc example system 2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee a51d6d3abd doc: Add a system to share ldoc content across multiple files
This avoid copy-pasting
2016-05-09 01:37:47 -04:00
Emmanuel Lepage Vallee e7652a053d tests: Add a new testing framework 2016-03-31 04:45:45 -04:00
Emmanuel Lepage Vallee b6871833c4 cmake: Generate gears.shape SVG and example code 2016-03-16 18:02:41 -04:00