Commit graph

285 commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
fe2da0a94f Put -Wno-redundant-move behind a compiler check
This fixes a warning under Ubuntu 18.04's default gcc
(cc++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0)
2020-07-04 21:14:43 -05:00
ridiculousfish
3b7feb38e9 Add pexpect-based interactive testing framework
This adds a new interactive test framework based on Python's pexpect. This
is intended to supplant the TCL expect-based tests.

New tests go in `tests/pexpects/`. As a proof-of-concept, the
pipeline.expect test and the (gnarly) bind.expect test are ported to the
new framework.
2020-06-07 14:46:21 -07:00
ridiculousfish
971f108bda Mark Intl cmake package as quiet
This suppresses not-very-interesting messages from CMake about whether
Intl was found or not.

Fixes #7091
2020-06-06 18:56:54 -07:00
Fabian Homborg
382595e1e9 Update some .md references 2020-05-30 10:07:21 +02:00
ridiculousfish
a9bfe7f164 Remove find_program(sed) from CMake
We no longer use sed.
2020-05-22 13:44:55 -07:00
ridiculousfish
84e0c8d32e Guard thread_local
Mac OS X 10.9 supports __thread but not C++11 thread_local.
Teach CMake to detect support for thread_local and use the proper
define guard.

Fixes #7023
2020-05-22 13:41:05 -07:00
ridiculousfish
b88b6ea504 Add CMake variable FISH_USE_SYSTEM_PCRE2
The CMake variable FISH_USE_SYSTEM_PCRE2 now controls whether fish uses
system PCRE2 or the bundled version. The default is to use the system
version, unless no such version is found, or unless it is a macOS build
with code signing. Note the default behavior has not changed.

Fixes #6952
2020-04-28 18:30:40 -07:00
ridiculousfish
3a47db74b0 Disable Mac codesigning if MAC_CODESIGN_ID is falsey
Fixes #6952
2020-04-28 10:34:06 -07:00
Simon Ser
e3684526f2 Change extra_*dir options to use prefix instead of /usr/local 2020-04-04 13:07:54 +02:00
Simon Ser
d9d3557fcf Use pkg-config variables
This allows all variables to be set properly when the prefix or datadir changes.

The generated .pc file looks like this:

    prefix=/usr/local
    datadir=${prefix}/share
    completionsdir=${datadir}/fish/vendor_completions.d
    functionsdir=${datadir}/fish/vendor_functions.d
    confdir=${datadir}/fish/vendor_conf.d

    Name: fish
    Description: fish, the friendly interactive shell
    URL: https://fishshell.com/
    Version: 3.1.0-402-g75ae172ba228-dirty

Closes: https://bugs.archlinux.org/task/65904
2020-04-04 13:07:54 +02:00
Malthe Jørgensen
8a068ed984 Allow finishing build on OS X <10.13.6
Building on OS X versions prior to 10.13.6 fails at the very end when
running `codesign`.
The `-options runtime`-argument isn't available on these earlier
versions of the OS.

Simply running codesign without that argument (on OS X <10.13.6) seems
to produce a runnable binary with no security warnings.
2020-03-29 14:51:05 -07:00
ridiculousfish
f117addf7c Use lowercase CMake function names
This is a best practice to distinguish them from variables.
2020-03-14 16:11:35 -07:00
ridiculousfish
24bd7e033e Move some Mac specific cmake bits into new Mac.cmake 2020-02-29 15:36:54 -08:00
Fabian Homborg
1106706927 cmake: Remove commented autotools code 2020-02-21 19:33:06 +01:00
Maya Rashish
934f708ef6 cmake: adjust logic for TPARM_VARARGS
- Define it before the headers so they can pick the variadic tparm
prototype.
- We need a TPARM_VARARGS define, add it to config_cmake.h.
- Move & adjust comment - put it near the code, and mentiont that
NetBSD curses doesn't need the kludge.

Now variadic tparm is used on NetBSD instead of the Solaris kludge.
2020-02-20 18:14:54 +01:00
Aaron Gyes
85a0ca66e0 We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
Aaron Gyes
cc5550c458 Move pcre2-10.34 to pcre2/ 2020-02-19 16:42:08 -08:00
ridiculousfish
21af36d5a7 Add an entitlements file to MacApp
Allows our notarized app to send AppleEvents
2020-02-18 12:56:54 -07:00
ridiculousfish
ba0c2d48d1 Teach CMake to code sign Mac executables
Perform an ad-hoc code signing with the hardened runtime.
This ensures that these executables can pass notarization.

The code signing ID is controlled by the MAC_CODESIGN_ID CMake
cache variable.
2020-02-18 12:55:11 -07:00
ridiculousfish
952d9eecf7 Always use bundled PCRE on Mac
A code-signed fish cannot load a PCRE that is not codesigned, which can
easily come about through Homebrew.
2020-02-18 12:55:11 -07:00
Aaron Gyes
b418e36f22 Take an axe to vendored PCRE2 bits & update it to 10.34
This commit updates PCRE2 to 10.34, and we no longer include what's in their
tarball as-is. I've yanked out a lot of uneccessary stuff for the sake of the
size of our codebase.

original pcre2-10.34 dir: 11.5MB
pcre2 dir in this commit:  1.6MB

 * Remove documentation, makefiles, test suites, etc. LICENSE remains.
 * Disable building tests when configuring PCRE2
 * Yard out JIT support: delete src/jit, src/pcre2_jit_*.c, and code doing
   stuff to code->executable_jit that needs a jit header (it was already NULL
   because we've always built with JIT disabled).
 * Remove most .c and .h files not needed to compile: pcre2grep code,
   pcre2test code, dftables.c, pcre2_printint.c, pcre2_fuzzsupport.c ...
 * Remove FindBZip2, FindZLIB, FindReadline, FindEditline. These were used
   only by pcre2grep and made CMake's report misleading with regard to
   optional packages being used.
 * Remove configure.ac except for version number and date which CMake checks

Next time we update PCRE2, refer to this commit message as well as a diff
between pcre2-10.34.tar.gz and ./pcre2-10.34/. Or better yet, cease including
pcre2.
2020-02-18 08:16:15 -08:00
David Adam
f36a391f26 fish.desktop: install .desktop and icon 2020-01-25 16:48:57 +08:00
David Adam
8ff0c351a9 vendor_*.d: also create these directories in the prefix 2020-01-25 16:12:20 +08:00
David Adam
81306d3b30 vendor_*.d: include /usr/local by default as "extra" directory
Closes #5029.
2020-01-25 16:12:20 +08:00
Johannes Altmanninger
e3782603ec Load vendor configuration from $XDG_DATA_DIRS/vendor_*.d
$XDG_DATA_DIRS/vendor_{completions,conf,functions}.d
Additionally, CMake variables extra_{completions,conf,functions}dir are
appended, if they are not already contained in $XDG_DATA_DIRS.

If XDG_DATA_DIRS is not defined, we fall back to

$__fish_datadir/vendor_completions.d:${extra_completionsdir}

for completions. Same for conf and functions.
2020-01-12 16:12:41 +01:00
David Adam
5df84c1998 cmake: use correct variable for C++ compiler flags
Broken in 8ca936aea6
2020-01-02 22:08:59 +08:00
David Adam
8ca936aea6 cmake: use C++ extension options when checking features
This matches the CMake default of extensions turned on.
2019-12-23 22:26:57 +08:00
David Adam
4d325dcd7a cmake: tidy up adding C++11 compile flags
Two blocks of code were trying to do the same thing in different ways;
standardise on one, and only add the compile flags if CMake won't do it
itself (policy CMP0067).
2019-12-23 22:26:57 +08:00
ridiculousfish
82baf74785 Attempt to fix the build
Move the CMake changes down in the file after the FIND_PACKAGE calls.
2019-12-22 12:31:14 -08:00
ridiculousfish
87854c81f5 Allow C++ standard to be passed to CHECK_CXX_SOURCE_COMPILES
Work around the issue in CMake where C++ standard doesn't get propagated
to CHECK_CXX_SOURCE_COMPILES. Also correctly check for std::make_unique;
the define was missing from the config.h header.
2019-12-22 12:07:46 -08:00
David Adam
45633f4a54 cmake: force C++11 in CHECK_CXX_SOURCE_COMPILES for atomic
GCC 4.8 requires the use of `-std=gnu++11` or similar to enable atomic
features. However, older versions of CMake don't pick up the
project-wide target for C++11 when building the configure check targets.
Although CMake policy 0067 could be set to NEW to enable this, it only
exists on CMake 3.8 and newer, while many of our supported platforms are
on an older version.
2019-12-21 22:00:22 +08:00
David Adam
8f2f3b648f cmake: check for 64-bit atomic operations directly
780bac671f did not actually successfully
compile on any platforms, leading to -latomic always being added
(including on platforms it does not exist on).

Work on #5865.
2019-12-20 23:47:46 +08:00
David Adam
780bac671f cmake: add -latomic on platforms that need it for 64-bit atomic operations
Closes #5865.
2019-12-20 23:00:06 +08:00
David Adam
3365410bde cmake: only define test policy on old versions
CMP0037 only reserves the test name if CTest is included on newer versions of CMake.

This commit fixes a build warning.
2019-11-01 20:58:40 +08:00
Johannes Altmanninger
b52d3d641e Fix clean build of sphinx-docs 2019-10-20 08:15:58 +02:00
Johannes Altmanninger
aa1bf9f277 sphinx: honor changes in static html assets
Also fix custom.css.
2019-10-19 14:52:24 +02:00
David Adam
8e0aa03c4a cmake: sphinx-manpages requires fish_indent for version number
Fixes issue #6216.

Problem introduced in 3b8505bebe.
2019-09-21 16:32:24 +08:00
David Adam
a10547018e cmake: don't install realpath manpage on non-macOS systems 2019-09-17 20:54:11 +08:00
ridiculousfish
97c4794424 Properly mark tests_dir as a dependency of test_prep
Allows for running a subset of tests immediately after build system config.
2019-07-21 11:21:50 -07:00
Fabian Homborg
cdbd0891f7 Remove invocation tests
These are now all performed by littlecheck, so there's no need for the
entire target anymore.
2019-06-25 22:31:45 +02:00
David Adam
8f3a0dcc8b cmake: harmonise argument to foreach/endforeach
Fixes a warning introduced in 40d91b7e77.
2019-06-23 16:00:40 +08:00
ridiculousfish
40d91b7e77 Allow running test suites independently
This makes test_low_level, test_interactive, test_invocation, and
test_fishscript independent. This allows running a smaller subset of tests.

To prevent all tests running in parallel, we also have new targets
serial_test_low_level, serial_test_interactive, etc. which have the
dependency chain that enforces serial execution.
2019-06-22 14:17:10 -07:00
ridiculousfish
db703c273d Remove some stale comments from Tests.cmake
These comments were used to refer back to the autotools build, but the
autotools build is no more and CMake is now the source of truth.
2019-06-22 13:12:49 -07:00
ridiculousfish
fcf0593dfb Port printf tests to littlecheck and teach the tester how to run it
This adds support for .check files inside the tests directory. .check
files are tests designed to be run with littlecheck.

Port printf test to littlecheck and remove the printf.in test.
2019-06-16 14:10:41 -07:00
David Adam
665ae3787a Switch to runtime check for /proc/self/stat
Removes a compile-time check that may have affected cross-compilation.

Work on #1067.
2019-04-30 16:23:28 +08:00
ridiculousfish
f35f2fe110 Mark the benchmark as using the terminal
Prevents buffering all output from the command.
2019-04-13 12:40:12 -07:00
ridiculousfish
c39950e49a Add benchmark target to CMake
This adds a benchmark target to CMake to run the new benchmarks.

example: ninja benchmark
2019-04-10 14:35:59 -07:00
ridiculousfish
b6555a0dc4 Add print-rusage-self to fish
This adds an option --print-rusage-self to the fish executable. When set,
this option prints some getrusage stats to the console in a human-readable
way. This will be used by upcoming benchmarking support.
2019-04-10 14:33:45 -07:00
ridiculousfish
93cc99d6d0 Teach CMake to tell Sphinx where fish_indent is 2019-04-08 19:11:10 -07:00
ridiculousfish
5b2c741f6c Add fish_indent_lexer.py
This is a pygments lexer that shells out to fish_indent
2019-04-08 19:09:53 -07:00
ridiculousfish
23d88e0e03 Add fish_test_helper executable
In tests we would like to arrange for an executable to invoke certain
system calls, e.g. to claim or relinquish control of the terminal. This is
annoying to do portably via e.g. perl. fish_test_helper is a little
program where we can add custom commands to make it act in certain ways.
2019-04-07 09:20:19 -07:00
Fabian Homborg
bfb61879cd Do create installation directories that already exist
Reverts 71329a250b.

That tried to fix problems with pkgconfig by not recreating it.
Instead, use the function we already have for not trying too hard to
create a directory.

Fixes #5735.
2019-03-12 18:50:45 +01:00
David Adam
08fd8b6472 cmake: fix prebuilt documentation detection and installation 2019-03-04 22:06:09 +08:00
David Adam
73d9f80772 cmake: drop obsolete paths for prebuilt documentation 2019-02-28 22:04:54 +11:00
David Adam
9acfe0261b cmake: install system manpath manpages
The build path of these files moved under Sphinx.
2019-02-28 22:03:57 +11:00
Fabian Homborg
3674efad0b Fix manpage directory
This installed files in man/ directly, instead of in man/man1/, so
they weren't installed.

See #5696.
2019-02-25 21:16:42 +01:00
Fabian Homborg
0e82fb8c47 Install sphinx files
Sphinx put the files into sphinx-root, which wasn't being installed.

Instead, use user_doc again, which we already used before.

Belongs to #5696.
2019-02-25 21:05:02 +01:00
ridiculousfish
4da38df43b Remove last vestiges of Doxygen from Docs.cmake 2019-02-24 19:02:39 -08:00
ridiculousfish
2ec33be90f CMake BUILD_DOCS option to look for sphinx instead of Doxygen 2019-02-24 18:58:25 -08:00
ridiculousfish
c46f02e01e Initial sphinx file import 2019-02-24 18:15:23 -08:00
David Adam
d44308388f cmake: use the check state stack for __nl_msg_cat_cntr checks 2019-02-19 21:35:30 +08:00
David Adam
7200f7ff4a Revert "Drop hard requirement on explicit -lpthread support"
This reverts commit b402b635a9f7466616cef6e2b9cfd55a6e7068c5; as discussed in #5512 it is not
required.
2019-02-12 22:30:53 +08:00
ridiculousfish
b952606430 Teach CMake Mac App build to dynamically derive the version
Populate CFBundleShortVersionString with the fish version from
git_version_gen.sh. Note this happens at build generation time, not at
build time.
2019-02-05 22:14:43 -08:00
ridiculousfish
e0396d8ef8 CMake support for building Mac app 2019-02-05 22:14:43 -08:00
Mahmoud Al-Qudsi
462cb6044c Use standard __CYGWIN__ define for Cygwin detection 2019-01-21 20:06:16 -06:00
Mahmoud Al-Qudsi
16a94db702 Check for -Werror=unguarded_availability support before forcing it
The compiler flag `-Werror=unguarded_availability` was hard-coded for
macOS, but is not supported by GCC on macOS 10.10 (Yosemite). Test for
support with CHECK_CXX_COMPILER_FLAG before forcing it.
2019-01-10 20:03:38 -06:00
Mahmoud Al-Qudsi
b402b635a9 Drop hard requirement on explicit -lpthread support
Closes #5512
2019-01-10 20:03:38 -06:00
Mahmoud Al-Qudsi
4f196eef64 Bypass mutually exclusive CMake checks
There are some redundant CMake checks, in the sense that they are either
not needed or cannot possibly match if a previous check already passed.
2019-01-04 14:46:36 -06:00
Mahmoud Al-Qudsi
5196a42165 Prevent CMake configure checks for affecting future checks
Using CMAKE_PUSH_CHECK_STATE/CMAKE_POP_CHECK_STATE to prevent CMake
checks from permanently altering the environment used by future checks.
2019-01-04 14:30:14 -06:00
Mahmoud Al-Qudsi
490432c177 Globally set the _GNU_SOURCE define for CMake configuration checks 2019-01-04 14:18:02 -06:00
Mahmoud Al-Qudsi
380bae80bf Fix wcstod_l detection under Linux
This was broken in a8eb02f9f5 when the
detection was corrected for FreeBSD. This patch makes the detection work
for both Linux and FreeBSD instead of one or the other (tested).
2019-01-02 19:07:53 -06:00
Mahmoud Al-Qudsi
7af0cad23d Fall back to CMake's pkg-config-based search for curses
CMake seems to have trouble finding libraries from multiarch packages
that do not have the compatibility symlink installed to the
arch-independent library directory. Users must either manually supply
the path to the library in question via command-line parameters or we
can fall back to CMake's alternate method of finding packages based off
of pkg-config rather than using the hard-coded `FindCurses` CMake module
specific to the CMake version/distribution installed.
2019-01-02 18:38:55 -06:00
Mahmoud Al-Qudsi
74422e476b Define _GNU_SOURCE for wcstod_l check 2019-01-02 14:05:49 -06:00
Mahmoud Al-Qudsi
d1913f0df0 Add workaround for Cygwin process management and job control bugs
We cannot wait by pgroup under Cygwin for unknown reasons. Always
wait on jobs by individual processes. See code for more information.
2019-01-02 00:14:07 -06:00
Fabian Homborg
a608e5d581 cmake: Check for TPARM_VARARGS 2018-12-31 14:24:22 +01:00
Mahmoud Al-Qudsi
a8eb02f9f5 Fix wcstod_l detection under FreeBSD 2018-12-31 02:31:48 -06:00
David Adam
b60a9d8c4a pcre2: move to PCRE2 10.32
Closes #5353.
2018-12-29 22:54:40 +08:00
Fabian Homborg
ffab420e43 Add fallback wcstod_l for musl
Just sets locale to "C" (because that's the only one we need), does
wcstod and resets the locale.

No idea why uselocale(loc) failed for me, but it did.

Fixes #5407.
2018-12-12 15:12:12 +01:00
David Adam
4f3786f8d0 Build system: add extra sysconf directories
Closes #5235.
2018-11-04 21:14:06 +08:00
David Adam
1e0fab4fa4 git_version_gen: add support for out-of-tree tarballs
Closes #4122.
2018-08-28 23:10:24 +08:00
ridiculousfish
11502c0d36 Teach cmake to run expect tests
Fixes #4794
2018-07-21 15:43:31 -07:00
Mahmoud Al-Qudsi
e26d5418af Revert "Blow away existing $fish_data_dir on (re)install"
This reverts commit e35983438e.
Reopens #4314. Closes #5007.

# Conflicts:
#	share/config.fish
2018-05-31 22:41:49 -05:00
Mahmoud Al-Qudsi
e35983438e Blow away existing $fish_data_dir on (re)install
Fixes #4314 (under cmake, at least)
2018-04-14 21:01:52 -05:00
David Adam
0f59e42802 [cmake] support prebuilt documentation in out-of-tree builds 2018-03-24 22:38:38 +08:00
David Adam
46e9bf86b8 [cmake] fix dependencies in documentation build
Closes two race conditions in parallel builds.
2018-03-24 22:38:38 +08:00
David Adam
0572b29f26 [cmake] install manual from binary directory
Fixes out-of-tree builds.
2018-03-24 22:38:38 +08:00
David Adam
b819f38e83 [cmake] fix selection of manual pages for installation 2018-03-24 22:38:38 +08:00
David Adam
a6d2b06529 [cmake] use full paths for extra configuration/function/completion dirs 2018-03-24 22:38:38 +08:00
David Adam
625ef5d734 [cmake] fix generation of fish pkgconfig file
Use `printf` instead of the non-portable `echo -n`.
2018-03-24 22:38:38 +08:00
David Adam
072bbe7e5d [cmake] add doc target to ALL
Closes #4809.
2018-03-24 22:38:38 +08:00
David Adam
b5aea3fd8b Revert "[cmake] Fix installing docs"
INSTALL_DOCS is not a controllable option, and is only used to indicate
whether they will be installed or not.

This reverts commit e800b18ee9.
2018-03-13 22:08:05 +08:00
Fabian Homborg
e800b18ee9 [cmake] Fix installing docs
Installing docs is not optional if they have been built
2018-03-13 12:55:05 +01:00
ridiculousfish
df4b03d859 Fix CMake documentation build path
This fixes a variety of issues related to building the documentation
with CMake. In particular it cleans up the dependency management and
fixes some issues where the documentation build was using generated
files from the source directory.
2018-03-05 12:13:34 -08:00
Mahmoud Al-Qudsi
000892e315 Use constexpr for is_windows_subsystem_for_linux()
To guarantee that at runtime there will be no branching, using a CMAKE
test/define combined with a constexpr wrapper for code-friendliness.
2018-03-04 21:13:31 -06:00
Mahmoud Al-Qudsi
71329a250b [cmake] Don't create installation directories that already exist
fish's cmake install routines were attempting to create system
directories that already existed, an operation for which the permissions
to do so may not be available (e.g. /usr/local/share/pkgconfig)

This commit first checks if a directory exists before creating it.
2018-03-04 15:46:29 -06:00
David Adam
2747945c55 [cmake] don't try too hard to create extra vendor directories
Homebrew and other systems set the path for the extra completion,
function and configuration directories outside the writeable prefix.

Mirror the autotools build in trying to create these directories, but
not causing the whole install to fail if this operation in unsuccessful.
2018-02-27 20:42:58 +08:00
Mahmoud Al-Qudsi
1b27c97bfb [cmake] Fix dependency path for FBVF for fish.pc rule
The custom command for fish.pc had a dependency on FBVF, but it appears
that the relative path to FBVF was incorrect and with CMake 3.10.1 under
FreeBSD this was consistently causing the build to fail if
../build_tools/git_version_gen.sh hadn't (coincidentally, I think?)
already run.

Explicitly set the dependency path for FBVF to the binary directory.
2018-02-21 13:58:56 -06:00
Mahmoud Al-Qudsi
9e1576bdc4 Revert "[cmake] Add rule to generate FBVF"
This reverts commit e4c59ac60a.

I hadn't seen the FBVF rule in the `Version` CMake file. There's
something else going on here.
2018-02-21 13:50:05 -06:00
Mahmoud Al-Qudsi
e4c59ac60a [cmake] Add rule to generate FBVF
The custom command for fish.pc had a dependency on FBVF, but there was
no cmake rule for the generation of the FBVF file. With CMake 3.10.1
under FreeBSD, this was consistently causing the build to fail if
../build_tools/git_version_gen.sh hadn't (coincidentally, I think?)
already run.
2018-02-21 13:40:15 -06:00
Mahmoud Al-Qudsi
fea1597a27 [cmake] Correct test for term.h (include curses.h first)
The non-ncurses version of term.h requires that curses.h be first
included. Only very recent versions of CMake include a LANGUAGE
option to CHECK_INCLUDE_FILES, so we aren't using it and specifying
CXX here..
2018-02-04 03:11:22 -06:00
David Adam
56be045324 [cmake] copy shipped documentation files if they exist
Enables documentation in tarballs to be installed, even if Doxygen isn't
present.
2018-02-01 22:46:27 +08:00
David Adam
e1bc48492f [cmake] only copy tests for out-of-tree builds
Makes in-tree builds work again.
2018-02-01 22:46:27 +08:00
David Adam
fb53a96a1c Add configure-time check for std::make_unique
Fixes the build on Clang 6 and closes #4685.
2018-01-31 13:43:05 +08:00
David Adam
f135c53196 [cmake] move all CheckFunctionExists to CheckCXXSymbolExists
CheckFunctionExists checks for C linkage only, and recommends the use of
CheckSymbolExists in the documentation. This improves the detection of
C++ features, as opposed to C features.
2018-01-30 22:28:04 +08:00
Mahmoud Al-Qudsi
462b9c2209 Fix broken fish.pc build on non-GNU platforms
`-v` is a non-standard GNU-only extension to `awk`, its usage in the
generation of the fish.pc script breaks on non-GNU platforms (such as
FreeBSD and presumably macOS).

Using `sed` with only standard posix commands instead.
2018-01-23 22:07:04 -06:00
David Adam
020fe5ccdf [cmake] fix installation of translations 2018-01-22 14:30:36 +08:00
David Adam
164108d0a9 [cmake] mark manual as an optional component for install 2018-01-21 20:37:29 +08:00
David Adam
9c7909c006 [cmake] install manual and changelog 2018-01-21 15:28:03 +08:00
David Adam
1231d358de [cmake] remove duplicate installation 2018-01-21 07:51:26 +08:00
David Adam
b6202c3c86 [cmake] actually use libintil headers/libraries if detected
Closes #4663.
2018-01-17 07:50:42 +08:00
David Adam
8875f0ad76 [cmake] make building documentation optional
Add a BUILD_DOCS option which is contingent on Doxygen being present,
and only build the documentation if this is enabled.
2018-01-14 21:16:11 +08:00
David Adam
8eb0608b00 [cmake] make build_lexicon_filter part of DocTargets only 2018-01-14 21:14:22 +08:00
ridiculousfish
8a78dca26f Remove PRE_BUILD from tests_dir target
It doesn't seem necessary and I can't justify what it's there for.
2018-01-10 19:38:21 -08:00
Markus Reitboeck
843ac2554d copy test files with ADD_CUSTOM_COMMAND
This will copy the files every time "make test" is called, so the files are never out of sync.

Fixes issue #4633
2018-01-10 19:10:39 -08:00
ridiculousfish
d09210c08b [cmake] Untangle the CMake versioning
This untangles the CMake versioning issues (I hope) as discussed in #4626.
Note most of the advice found on the Internet about how to inject git
versions into CMake is just wrong.

The behavior we want is to unconditionally run the script
build_tools/git_version_gen.sh at build time (i.e. when you invoke ninja or
make, and not when you invoke cmake, which is build system generation time).
This script is careful to only update the FISH-BUILD-VERSION-FILE if the
contents have changed, to avoid spurious rebuilding dependencies of
FISH-BUILD-VERSION-FILE. Assuming the git version hasn't changed, the script
will run, but not update FISH-BUILD-VERSION-FILE, and therefore
fish_version.o will not have to be rebuilt.

This might normally rebuild more than is necessary even if the timestamp is
not updated, because ninja computes the dependency chain ahead of time. But
Ninja also supports the 'restat' option for just this case, and CMake is rad
and exposes this via BYPRODUCTS. So mark FISH-BUILD-VERSION-FILE as a
byproduct and make the script always update a dummy file
(fish-build-version-witness.txt). Note this is the use case for which
BYPRODUCTS is designed.

We also have fish_version.cpp #include "FISH-BUILD-VERSION-FILE", and do a
semi-silly thing and make FISH-BUILD-VERSION-FILE valid C++ (so there's just
one version file). This means we have to filter out the quotes in other
cases..
2018-01-08 22:28:10 -08:00
ridiculousfish
21cfdf04bd Revert "[cmake] Remove build_fish_pc target"
This reverts commit 585321181d.

With the build_fish_pc target, a command like this fails:
  env DESTDIR=/tmp/fish-install ninja install
2018-01-08 22:28:10 -08:00
ridiculousfish
da8db7f6f0 Revert "Generate FISH_BUILD_VERSION info for cmake builds"
This reverts commit 25839b8c36.

This was an attempt to simplify the version generation, but it
computed the version at build sytem generation time rather than
at build time, requiring another run of CMake to update it.
2018-01-08 22:28:10 -08:00
Fabian Homborg
585321181d [cmake] Remove build_fish_pc target
The dependency on fish.pc just does not work.

This still installs the pc file with the proper version, so it should work.
2018-01-01 13:02:39 +01:00
Mahmoud Al-Qudsi
25839b8c36 Generate FISH_BUILD_VERSION info for cmake builds
Correctly generate FISH_BUILD_VERSION for use in fish_version.h/cpp and
fish.pc to allow `fish --version` and `echo $version` to work again.

Not needing the same convoluted measures used by Makefile builds to
prevent the regeneration of the fish version file when it hasn't
changed.

Purposely created a new `cmake_git_version_gen.sh` file so that the old
`git_version_gen.sh` remains compatible with the existing Makefile build
script. Same reason why `fish.pc.in` was not modified to use a lowercase
variable name to match the CMAKE variable of the same name.

Closes #4626
2017-12-30 17:38:09 -06:00
Mahmoud Al-Qudsi
87f7cd0370 Fix make install failure on missing man pages
If `doxygen` isn't installed, the man files aren't built and that's
quite ok. The cmake `install` target was presuming the man files would
always be present and the install stage was failing if they weren't
built.
2017-12-28 15:22:31 -06:00
ridiculousfish
f563262cfd Mark tests as USES_TERMINAL
This allows the Ninja build to show the test output live.
This requires bumping the min required CMake version to 3.2 (from 3.1)
2017-12-21 12:48:17 -08:00
David Adam
7faa6e773f cmake: add SED to build_lexicon_filter 2017-11-28 21:37:42 +08:00
David Adam
ce46c80492 cmake: restore check for fixed-args tparm ("Solaris tparm kludge") 2017-11-22 18:58:27 +08:00
David Adam
64194d02fc cmake: correct configure check for _nl_msg_cat_cntr 2017-11-17 16:21:56 +08:00
David Adam
32714021f5 cmake: add gettext support 2017-11-17 16:21:56 +08:00
David Adam
7e24c14f8c cmake: print feature summary 2017-11-17 16:21:56 +08:00
David Adam
8543a4061e cmake: fix check for /proc/self/stat
Using the result of the exists test directly always passes.
2017-11-17 16:21:56 +08:00
David Adam
af93db668c cmake: fix check for sys/sysctl.h on FreeBSD 2017-11-17 16:21:56 +08:00
David Adam
f5209deacc cmake: update CheckIncludeFiles to enable C++ checks 2017-11-17 16:21:56 +08:00
David Adam
2f289ce097 cmake: drop unneeded checks
Much cruft brought across from autoconf is removed.
2017-11-17 16:21:56 +08:00
David Adam
57bfca17dc cmake: make WINSIZE checks work 2017-11-17 16:21:56 +08:00
David Adam
a8938bcb4d cmake: check for stat struct items correctly 2017-11-17 16:21:56 +08:00
David Adam
68da7ab822 cmake: use C++ rather than C checks for all checks
Disables C language for fish project to catch errors.
2017-11-17 16:21:56 +08:00
David Adam
8f7d68ee3e cmake: use correct syntax for CheckStructHasMember
Correctly detect the dirent member d_type on systems that have it.
2017-11-17 16:21:56 +08:00
David Adam
396faebc08 Move CMakeFiles to cmake
Makes in-tree (ie `cmake .`) builds work.
2017-11-17 16:21:55 +08:00