Commit Graph

154 Commits

Author SHA1 Message Date
Johannes Altmanninger
2fff12104d Correct test environment setup
XDG_RUNTIME_DIR was misspelled.
XDG_DATA_DIRS could affect tests. Remove it since it's used read-only.
2021-04-21 00:47:03 +02:00
ridiculousfish
43cc99e1ba Group certain cmake targets into folders
This makes folders in IDEs for certain Mac and gettext targets, reducing
the number of targets which appear at top-level.
2021-03-21 13:29:41 -07:00
ridiculousfish
1b950f5f3b Switch fish.pc dependency from FBVF file to CHECK-FBVF target
Previously, both fish.pc and libfish had generating the
FISH-BUILD-VERSION-FILE attached as a command. In principle they could
both try to run the command simultaneously and now CMake complains about
this with the Xcode generator.

Switch to having fish.pc depend on the CHECK-FISH-BUILD-VERSION-FILE as a
target instead of a command. This allows it to participate in dependency
resolution and CMake will succeed again.

Fixes #7838
2021-03-21 12:39:24 -07:00
Joel Rosdahl
76b6959cad Fix parallel build race condition for test targets
When executing “make test -jX” (with X > 1) to build and run tests in a
build directory, there is a race condition between the
serial_test_low_level target and the test_prep target (a dependency of
serial_test_fishscript and serial_test_interactive).

As far as I can tell, these events happen in a serial build scenario
(“make test” with the “Unix Makefiles” CMake generator):

  1. The fish_tests binary is built and executed.
  2. The test_prep target (a dependency of serial_test_fishscript)
     cleans up test directories.
  3. Tests in test.fish are executed.

In a parallel build scenario, this often happens:

  1. Build of the fish_tests binary is started.
  2. The test_prep target cleans up test directories.
  3. Build of the fish_tests binary is finished.
  4. Execution of the fish_tests binary starts.
  5. Execution of the fish_tests binary finishes.
  6. Tests in test.fish are executed.

However, if building the fish_tests binary is fast enough but not
instant (e.g. when using ccache), this can happen:

  1. Build of the fish_tests binary is started.
  2. Build of the fish_tests binary is finished.
  3. Execution of the fish_tests binary starts.
  4. The test_prep target cleans up test directories.
  5. fish_tests tests that depend on said test directories may,
     depending on timing, fail because they are wiped by test_prep.

Fix this by making test_prep a dependency of serial_test_low_level so
that test_prep can’t interfere with fish_tests execution.
2021-03-09 21:49:52 +01:00
Fabian Homborg
a36dbad3b8 cmake: Stop copying css files
custom no longer exists and pygments is just with the theme
2021-03-02 17:04:47 +01:00
Mahmoud Al-Qudsi
050fd342da Support both GCC's Wno-redundant-move and LLVM's Wredundant-move 2021-02-22 15:44:17 -06:00
Fabian Homborg
9b763581cf cmake: Only check mbrtowc on Apple
The only thing we know ever triggered this is old macOS versions,
there's no need to use it for everyone else.

Since this uses try_run it breaks when cross-compiling, which
shouldn't be a common thing on macOS.

Fixes #7737
2021-02-22 20:17:17 +01:00
ridiculousfish
8066428feb Add fd_event_signaller_t
fd_event_signaller_t exists to expose eventfd under Linux. This is a
more lightweight way of signalling events than using a pipe.
2021-02-07 10:59:10 -08:00
ridiculousfish
b79ec0122a Use pipe2 when creating pipes if avaialble
This allows us to avoid marking the pipe as CLOEXEC in some cases,
saving a system call.
2021-02-05 17:58:08 -08:00
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