Commit graph

195 commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
4c2a0de5de Override all XDG paths when running tests
This is far preferable to the per-test XDG overrides that we may or may
not remember to add the next time around.

Also rename all the directories so it is clear via which variable a file
made its way into that path.
2020-10-25 23:01:51 -05:00
Fabian Homborg
d8af0d2eec Stop creating a "build," directory
This was a typo. CMake doesn't take comma-separated arguments, but if
you do add the comma it tends to work, because it just takes that
comma as part of the string. So if it takes a directory to work in,
that it will then create, and you pass

${CMAKE_CURRENT_BINARY_DIR},

well, that might just create a "build," directory.
2020-10-06 17:55:44 +02:00
ridiculousfish
1390112b46 Suppress linker warnings in Mac debug builds
fish wants to build with -mmacosx-version-min=10.9. This is important
because it ensures that we do not use functions or linker features which
which are not available on 10.9. However this collides with the fact
that fish also prefers to use a pcre2 package installed on the system,
which is typically built for that system.

Mac ld will (rightly) complain when it sees a 10.9-targeted binary
linking a 10.15-targeted dylib. This is an annoying warning that gets
emitted on every build.

We could fix this either having Mac builds prefer the vendored PCRE2
by default, or by having debug builds target the system version. But
we want to continue to default to system PCRE2 and we don't want to risk
losing compatibility with older Mac versions. So we will just suppress
all linker warnings in Mac debug builds.
2020-09-27 11:35:16 -07:00
Mahmoud Al-Qudsi
1365379518 Optimize away a str2wcs_internal check
str2wcs_internal is one of worst hot paths in the codebase, and this
particular check can be optimized away for non-macOS hosts at compile
time.
2020-09-07 18:05:18 -05:00
Soumya
56c64281bd Update -latomic check to match the one in LLVM.
It's not entirely clear why the existing check does not work, but it seems to pass on clang++ even without -latomic, but causes the fish build to fail later.

Confirmed that with this change, g++ does not use -latomic, while clang++ does, and fish builds fine with both.
2020-08-05 12:23:49 -07:00
ridiculousfish
d823eee339 Disable code signing by default on the Mac
This has caused too much pain for other packagers.
2020-07-31 12:11:20 -07:00
Ryan Burns
ca4f2369d1 Fix build when ncurses is in nonstandard prefix 2020-07-25 11:21:36 -07:00
ridiculousfish
7ea396ab3f Remove lrand48 checks and support
lrand48 is no longer used.
2020-07-08 11:00:12 -07:00
Mahmoud Al-Qudsi
4a5f0f3a3d Fix missing references when manually linking against curses
When CMake's own curses logic fails to find curses/ncurses, we fall back to
pkg-config and manually link the required libraries. Some platforms (RHEL 6,
see #6587) require CURSES_EXTRA_LIBRARY=tinfo, so we link against libtinfo
if it's found but are happy to continue without it if it doesn't exist.

Closes #6587
2020-07-08 10:58:41 -05:00
Mahmoud Al-Qudsi
fb4967945a fixup! Put -Wno-redundant-move behind a compiler check
Use -Werror in the CMake test because the compiler check passes even
if warnings are emitted.
2020-07-05 13:31:28 -05:00
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