Commit Graph

46 Commits

Author SHA1 Message Date
Nirbheek Chauhan 8e06ab6a95 Use a script to clean-up custom-target output dirs
The script will manually delete all custom_target outputs that are
directories instead of files. This is needed because on platforms other
than Windows, Ninja only deletes directories while cleaning if they are
empty.

Closes #1220
2016-12-19 22:31:26 +05:30
Igor Gnatenko 5bf22c5678 add support for $sharedstatedir
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-18 00:08:45 +01:00
Igor Gnatenko 2962d3a66b add support for $infodir
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-18 00:01:27 +01:00
Igor Gnatenko 380b362fa4 add support for $sbindir
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-18 00:01:23 +01:00
Igor Gnatenko c9818c02ec add builtin support for localstatedir
Reported-by: Richard Hughes <richard@hughsie.com>
Closes: https://github.com/mesonbuild/meson/issues/1142
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-12-06 20:27:02 +02:00
Jussi Pakkanen 3ab117fd52 Tell users about mesonconf if they try to run Meson on an existing build dir. 2016-12-03 00:04:34 +02:00
Sam Thursfield ac56f8d8fb Don't show tracebacks for MesonException in helper scripts
I hit an issue when building gtk-doc documentation. The issue is
my fault, but the error output from Meson makes it look like an
internal error:

    [0/1] 'Running external command libtracker-sparql-doc.'
    Building documentation for libtracker-sparql
    Traceback (most recent call last):
      File "/home/sam/meson/meson.py", line 26, in <module>
        sys.exit(main())
      File "/home/sam/meson/meson.py", line 23, in main
        return mesonmain.run(launcher, sys.argv[1:])
      File "/home/sam/meson/mesonbuild/mesonmain.py", line 249, in run
        sys.exit(run_script_command(args[1:]))
      File "/home/sam/meson/mesonbuild/mesonmain.py", line 239, in run_script_command
        return cmdfunc(cmdargs)
      File "/home/sam/meson/mesonbuild/scripts/gtkdochelper.py", line 183, in run
        options.ignore_headers.split('@@') if options.ignore_headers else [])
      File "/home/sam/meson/mesonbuild/scripts/gtkdochelper.py", line 133, in build_gtkdoc
        gtkdoc_run_check(mkhtml_cmd, os.path.join(abs_out, 'html'))
      File "/home/sam/meson/mesonbuild/scripts/gtkdochelper.py", line 55, in gtkdoc_run_check
        raise MesonException('\n'.join(err_msg))
    mesonbuild.mesonlib.MesonException: 'gtkdoc-mkhtml' failed with status 6
    warning: failed to load external entity "../overview.sgml"
    ../libtracker-sparql-docs.sgml:20: element include: XInclude error :
    could not load ../overview.sgml, and no fallback was found
    warning: failed to load external entity "../examples.sgml"
    ../libtracker-sparql-docs.sgml:41: element include: XInclude error :
    could not load ../examples.sgml, and no fallback was found

    FAILED: libtracker-sparql-doc

After this patch, the output is much clearer:

    [0/1] 'Running external command libtracker-sparql-doc.'
    Building documentation for libtracker-sparql

    Error in gtkdoc helper script:
    'gtkdoc-mkhtml' failed with status 6
    warning: failed to load external entity "../overview.sgml"
    ../libtracker-sparql-docs.sgml:20: element include: XInclude error :
    could not load ../overview.sgml, and no fallback was found
    warning: failed to load external entity "../examples.sgml"
    ../libtracker-sparql-docs.sgml:41: element include: XInclude error :
    could not load ../examples.sgml, and no fallback was found

Note the actual errors from xsltproc are swallowed by gtkdoc-mkhtml
1.25.1, they're only displayed in the example above because I made a
patch: <https://bugzilla.gnome.org/show_bug.cgi?id=774812>
2016-11-26 12:11:59 -05:00
Jussi Pakkanen c7ddce163f All testing is now in mesontest.py, which simplifies a lot of stuff. 2016-11-18 22:10:22 +02:00
Jussi Pakkanen 4d8e3be08f Create target directory if it does not exist. Closes #935. 2016-11-09 11:26:04 -05:00
Nirbheek Chauhan a2262103fb Implement mlog.warning and use it everywhere for warnings
Prepends the string with 'WARNING:' in ANSI yellow.

Closes https://github.com/mesonbuild/meson/issues/961
2016-11-08 17:43:24 -05:00
Patrick Griffis 1781129740 gnome: Add yelp() function
Fixes #881
Mentioned in #295
2016-10-19 18:44:19 -04:00
Igor Gnatenko a513bcfde6 allow libdir/includedir/etc. be absolute paths
In Fedora we don't care about prefix, we want to ensure that libdir
is /usr/lib64, localedir is /usr/share/locale, and cetera.

Additionally, we don't need to ensure that prefix is absolute as we
check it in main.

Fixes: cc19bf0f45 ("Move option validation in objects rather than doing it only in the conf script.")
Closes: https://github.com/mesonbuild/meson/issues/869
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-10-11 00:57:01 +03:00
Jussi Pakkanen e2b3752f87 Show error log options in help. 2016-10-10 19:51:48 +03:00
Emanuele Aina 6c50253645 Use argv[0] to internally relaunch meson.py
When installing Meson, distutils may choose to put shim scripts in the
`PATH` that only set up the egg requirements before launching the real
`meson.py` contained in the egg.

This means that `__file__` points to the real `meson.py` file, but
launching it directly is doomed to fail as it's missing the metadata
contained in the shim to set up the path egg, resulting in errors when
trying to import the `mesonbuild` module.

A similar issue affects Meson when installed as a zipapp, with the
current code going great lengths to figure out how to relaunch itself.

Using `argv[0]` avoids these issues as it gives us the way the current
executable has been launched, so we are pretty much guaranteed that
using it will create another instance of the same executable. We only
need to resolve relative paths as the current working directory may
get changed before re-launching the script, and using `realpath()` for
that saves us the trouble of manually resolving links and getting caught
in endless loops.

This also mean that `meson_script_file` no longer necessarily point to a
absolute file, so rename it to `_launcher` which hopefully would be less
prone to inducing false assumptions.
2016-10-08 15:41:31 +02:00
Jussi Pakkanen 1f4cce86ad Remove shebangs on files that are not runnable and add execute bits to those that are. 2016-10-07 21:10:33 +03:00
Jussi Pakkanen cdf0c4f1a9 Merge branch 'QuLogic-context-managers' 2016-09-01 23:12:06 +03:00
Elliott Sales de Andrade 0cf065e12b Use argparse's builtin version printer. 2016-08-30 01:59:55 -04:00
Elliott Sales de Andrade 4c71695e41 Use context manager for file I/O.
There are a few cases where a context manager cannot be used, such as
the logger.
2016-08-27 18:29:55 -04:00
Jussi Pakkanen c4ade56150 Added sysconfdir option. Closes #694. 2016-08-21 15:57:38 +03:00
Nirbheek Chauhan 018fa4b90f vs: Fix regen_checker by using the correct coredata mtime
After c01b183e5, the mtime of coredata.dat is always newer than all the
other build files, which made regen_checker think that they always had
to be regenerated. Now we set the mtime of the file to a value before
the build files are generated and that makes everything behave as it did
earlier.
2016-07-29 08:18:59 +05:30
Jussi Pakkanen 9e37c8a308 Warn if PKG_CONFIG_PATH has changed because it may cause dependency detection to fail. Closes #626. 2016-07-15 20:52:27 +03:00
Nirbheek Chauhan c01b183e54 mesonmain: Dump the coredata last
Otherwise we'll mark the build directory as successfully configured even
if there's an error while doing the actual generation.

Reported on IRC by 'sdgsgad'
2016-07-15 18:12:33 +05:30
Nicolas Schneider fba749fcb7 extract vs2015backend into own file 2016-05-30 22:00:20 +02:00
Nicolas Schneider 3bedca0257 add vs2015 backend 2016-05-30 21:49:35 +02:00
Jussi Pakkanen babdb27570 Merge pull request #479 from mesonbuild/i18n
Moved gettext into i18n module.
2016-05-25 17:53:35 +03:00
Jussi Pakkanen 1a0938cc25 Automagic scan-build support. 2016-05-22 19:24:59 +03:00
Jussi Pakkanen dc148e0702 Remove all special casing for gettext and use elementary operations instead. 2016-05-21 18:21:23 +03:00
Nirbheek Chauhan e3bc2e5c68 ninja: Set PATH for CustomTargets with built EXEs on Windows
When a CustomTarget is run with a command that is an executable built
by the project which also has a DLL built in the same project as a
dependency, the EXE can't run on Windows because the DLL can't be found.
On UNIX-like systems, we set the RPATH using the linker so these
dependencies can be found, but on Windows the only way is to set the
PATH environment variable.

The same problem exists for tests, so we reuse that infrastructure by
creating a new meson_exe.py script that can be used as a wrapper to run
CustomTarget commands on Windows. This can later also be extended to add
support for setting an environment while calling the command needed to
generate a CustomTarget: https://github.com/mesonbuild/meson/issues/266
2016-04-15 05:49:42 +05:30
Hemmo Nieminen af6f4c9b9c coredata: Centralize builtin option descriptions and definitions. 2016-04-04 02:52:30 +03:00
Hemmo Nieminen 336904b553 Move MesonException from coredata to mesonlib. 2016-04-01 00:52:45 +03:00
Jussi Pakkanen d87eb7d290 Merge branch 'base_options'. 2016-03-20 22:04:24 +02:00
Jussi Pakkanen 79de463993 Converted precompiled headers into a base option. 2016-03-20 19:35:42 +02:00
Jussi Pakkanen 0c63f75aaf Converted coverage into a base option. 2016-03-20 19:16:49 +02:00
Nirbheek Chauhan 11f63105d0 New builtin option: libexecdir for installation of helper executables 2016-03-17 16:17:06 +05:30
Nicolas Schneider 92187501ed Can add postconfigure script. 2016-03-01 14:07:38 +01:00
Nicolas Schneider ac5ee0c414 dump coredata to file before calling backend.generate()
This ensures that all build files always have a later timestamp than
coredata.dat, which is used to check if the build files must be
regenerated.
2016-02-25 23:13:29 +01:00
Jussi Pakkanen 6f907dd4ab Merge pull request #358 from tp-m/no-args
Try harder to infer build and source directories if called without arguments.
2016-02-24 22:45:14 +02:00
Jussi Pakkanen d88223bd61 Do delayed argument setting properly this time. 2016-02-22 21:28:34 +02:00
Jussi Pakkanen 0469128f46 Preserve 'C:\' as an absolute path in prefix. 2016-02-21 13:14:25 +02:00
Nirbheek Chauhan a901024d33 When erroring out due to invalid prefix, print the value
Helps with debugging what's going wrong
2016-02-17 15:03:54 +05:30
Jussi Pakkanen 755d22afbd Strip trailing slash from prefix. Closes #366. 2016-01-25 21:55:56 +02:00
Jussi Pakkanen 7435df8399 Moved backends to their own module. 2016-01-23 20:02:52 +02:00
Tim-Philipp Müller f5d63cd47e meson: try harder to infer build and source directories if called without arguments
If there's no meson.build file in the current directory
and there is one in the parent directory, assume that
we are in the build directory.
2016-01-19 00:02:28 +00:00
Jussi Pakkanen eda57f887a Improve command line arg behaviour. 2016-01-16 23:04:41 +02:00
Jussi Pakkanen d6e176f455 Made gtkdoc and run targets work. 2016-01-16 18:04:59 +02:00
Jussi Pakkanen 23b98cd6e6 Renamed meson package to mesonbuild so that we can have a script named meson in the same toplevel dir. 2016-01-16 17:35:29 +02:00