diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 38ffbf481..87733a691 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: run: | make test - ubuntu-32bit-vendored-pcre2: + ubuntu-32bit-fetched-pcre2: runs-on: ubuntu-latest diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 755292dc6..4fbbbff8c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -42,7 +42,7 @@ Other improvements For distributors ---------------- -- *Placeholder text* +- The vendored PCRE2 sources have been removed. It is recommended to declare PCRE2 as a dependency when packaging fish. If the CMake variable FISH_USE_SYSTEM_PCRE2 is false, fish will now download and build PCRE2 from the official repo (:issue:`8355`). Note this variable defaults to true if PCRE2 is found installed on the system. -------------- diff --git a/README.rst b/README.rst index 80a2a19b3..7892985d6 100644 --- a/README.rst +++ b/README.rst @@ -148,7 +148,7 @@ Compiling fish requires: - a C++11 compiler (g++ 4.8 or later, or clang 3.3 or later) - CMake (version 3.5 or later) - a curses implementation such as ncurses (headers and libraries) -- PCRE2 (headers and libraries) - a copy is included with fish +- PCRE2 (headers and libraries) - optional, this will be downloaded if missing - gettext (headers and libraries) - optional, for translation support Sphinx is also optionally required to build the documentation from a diff --git a/build_tools/make_pkg.sh b/build_tools/make_pkg.sh index d4fcd9934..4d8e9b54a 100755 --- a/build_tools/make_pkg.sh +++ b/build_tools/make_pkg.sh @@ -27,7 +27,10 @@ SRC_DIR=$PWD OUTPUT_PATH=${FISH_ARTEFACT_PATH:-~/fish_built} mkdir -p "$PKGDIR/build" "$PKGDIR/root" "$PKGDIR/intermediates" "$PKGDIR/dst" -{ cd "$PKGDIR/build" && cmake -DMAC_INJECT_GET_TASK_ALLOW=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_GETTEXT=OFF -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DMAC_CODESIGN_ID="${MAC_CODESIGN_ID}" "$SRC_DIR" && make VERBOSE=1 -j 12 && env DESTDIR="$PKGDIR/root/" make install; } + +# Pass FISH_USE_SYSTEM_PCRE2=OFF because a system PCRE2 on macOS will not be signed by fish, +# and will probably not be built universal, so the package will fail to validate/run on other systems. +{ cd "$PKGDIR/build" && cmake -DMAC_INJECT_GET_TASK_ALLOW=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_GETTEXT=OFF -DFISH_USE_SYSTEM_PCRE2=OFF -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DMAC_CODESIGN_ID="${MAC_CODESIGN_ID}" "$SRC_DIR" && make VERBOSE=1 -j 12 && env DESTDIR="$PKGDIR/root/" make install; } pkgbuild --scripts "$SRC_DIR/build_tools/osx_package_scripts" --root "$PKGDIR/root/" --identifier 'com.ridiculousfish.fish-shell-pkg' --version "$VERSION" "$PKGDIR/intermediates/fish.pkg" productbuild --package-path "$PKGDIR/intermediates" --distribution "$SRC_DIR/build_tools/osx_distribution.xml" --resources "$SRC_DIR/build_tools/osx_package_resources/" "$OUTPUT_PATH/fish-$VERSION.pkg" @@ -37,4 +40,4 @@ productsign --sign "${MAC_PRODUCTSIGN_ID}" "$OUTPUT_PATH/fish-$VERSION.pkg" "$OU # Make the app { cd "$PKGDIR/build" && make -j 12 signed_fish_macapp && zip -r "$OUTPUT_PATH/fish-$VERSION.app.zip" fish.app; } -rm -r "$PKGDIR" +rm -rf "$PKGDIR" diff --git a/cmake/PCRE2.cmake b/cmake/PCRE2.cmake index 724d22255..b9138fe2e 100644 --- a/cmake/PCRE2.cmake +++ b/cmake/PCRE2.cmake @@ -28,16 +28,37 @@ else() endif() set(FISH_USE_SYSTEM_PCRE2 ${USE_SYS_PCRE2_DEFAULT} CACHE BOOL - "Use PCRE2 from the system, instead of bundled with fish") + "Use PCRE2 from the system, instead of fetching and building it") if(FISH_USE_SYSTEM_PCRE2) set(PCRE2_LIB "${SYS_PCRE2_LIB}") set(PCRE2_INCLUDE_DIR "${SYS_PCRE2_INCLUDE_DIR}") message(STATUS "Using system PCRE2 library ${PCRE2_INCLUDE_DIR}") else() - message(STATUS "Using bundled PCRE2 library") - add_subdirectory(pcre2 EXCLUDE_FROM_ALL) - set(PCRE2_INCLUDE_DIR ${CMAKE_BINARY_DIR}/pcre2) + include(FetchContent RESULT_VARIABLE HAVE_FetchContent) + if (${HAVE_FetchContent} STREQUAL "NOTFOUND") + message(FATAL_ERROR "Please install PCRE2 headers, or CMake >= 3.11 so I can download PCRE") + endif() + set(CMAKE_TLS_VERIFY true) + set(PCRE2_REPO "https://github.com/PhilipHazel/pcre2.git") + + message(STATUS "Fetching and configuring PCRE2 from ${PCRE2_REPO}") + Set(FETCHCONTENT_QUIET FALSE) + FetchContent_Declare( + pcre2 + GIT_REPOSITORY ${PCRE2_REPO} + GIT_TAG "72669190cb947f0cac1d038a8bb1820da59ef447" # tag: pcre2-10.36 + GIT_PROGRESS TRUE + ) + # Don't try FetchContent_MakeAvailable, there's no way to add EXCLUDE_FROM_ALL + # so we end up installing all of PCRE2 including its headers, man pages, etc. + FetchContent_GetProperties(pcre2) + if (NOT pcre2_POPULATED) + FetchContent_Populate(pcre2) + add_subdirectory(${pcre2_SOURCE_DIR} ${pcre2_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + + set(PCRE2_INCLUDE_DIR ${pcre2_BINARY_DIR}) set(PCRE2_LIB pcre2-${PCRE2_WIDTH}) # Disable -Wunused-macros inside PCRE2, as it is noisy. diff --git a/pcre2/132html b/pcre2/132html deleted file mode 100755 index 1bd62ba24..000000000 --- a/pcre2/132html +++ /dev/null @@ -1,314 +0,0 @@ -#! /usr/bin/perl -w - -# Script to turn PCRE2 man pages into HTML - - -# Subroutine to handle font changes and other escapes - -sub do_line { -my($s) = $_[0]; - -$s =~ s/</g; # Deal with < and > -$s =~ s/>/>/g; -$s =~ s"\\fI(.*?)\\f[RP]"$1"g; -$s =~ s"\\fB(.*?)\\f[RP]"$1"g; -$s =~ s"\\e"\\"g; -$s =~ s/(?<=Copyright )\(c\)/©/g; -$s; -} - -# Subroutine to ensure not in a paragraph - -sub end_para { -if ($inpara) - { - print TEMP "\n" if ($inpre); - print TEMP "
\n"; - } -$inpara = $inpre = 0; -$wrotetext = 0; -} - -# Subroutine to start a new paragraph - -sub new_para { -&end_para(); -print TEMP "\n";
-$inpara = 1;
-}
-
-
-# Main program
-
-$innf = 0;
-$inpara = 0;
-$inpre = 0;
-$wrotetext = 0;
-$toc = 0;
-$ref = 1;
-
-while ($#ARGV >= 0 && $ARGV[0] =~ /^-/)
- {
- $toc = 1 if $ARGV[0] eq "-toc";
- shift;
- }
-
-# Initial output to STDOUT
-
-print <
-Return to the PCRE2 index page.
-
-This page is part of the PCRE2 HTML documentation. It was generated
-automatically from the original man page. If there is any nonsense in it,
-please consult the man page, in case the conversion went wrong.
-$ARGV[0] man page
-
-End
-
-print "\n" if ($toc);
-
-open(TEMP, ">/tmp/$$") || die "Can't open /tmp/$$ for output\n";
-
-while (
\n" if ($toc);
-
-# Copy the remainder to the standard output
-
-close(TEMP);
-open(TEMP, "/tmp/$$") || die "Can't open /tmp/$$ for input\n";
-
-print while (
- # and
that delimit literal sections will do the spacing. Always skip
- # if no previous output.
-
- elsif (/^\.sp/)
- {
- if ($wrotetext)
- {
- $_ =
\n
\n" if ($innf || /^\.nf/ || !/^[\s.]/);
- }
- redo; # Now process the lookahead line we just read
- }
- }
- elsif (/^\.TP/ || /^\.PP/ || /^\.P/)
- {
- &new_para();
- }
- elsif (/^\.SH\s*("?)(.*)\1/)
- {
- # Ignore the NAME section
- if ($2 =~ /^NAME\b/)
- {
-
$title
\n",
- $ref);
- $ref++;
- }
- else
- {
- print TEMP "
\n$title\n
\n";
- }
- }
- elsif (/^\.SS\s*("?)(.*)\1/)
- {
- &end_para();
- my($title) = &do_line($2);
- print TEMP "
\n$title\n
\n";
- }
- elsif (/^\.B\s*(.*)/)
- {
- &new_para() if (!$inpara);
- $_ = &do_line($1);
- s/"(.*?)"/$1/g;
- print TEMP "$_\n";
- $wrotetext = 1;
- }
- elsif (/^\.I\s*(.*)/)
- {
- &new_para() if (!$inpara);
- $_ = &do_line($1);
- s/"(.*?)"/$1/g;
- print TEMP "$_\n";
- $wrotetext = 1;
- }
-
- # A comment that starts "HREF" takes the next line as a name that
- # is turned into a hyperlink, using the text given, which might be
- # in a special font. If it ends in () or (digits) or punctuation, they
- # aren't part of the link.
-
- elsif (/^\.\\"\s*HREF/)
- {
- $_=\n";
- while (
\n";
- $inpre = 1;
- }
- }
- elsif ($inpre)
- {
- print TEMP "\n";
- $inpre = 0;
- }
-
- # Add
to the end of a non-literal line if we are within .nf/.fi
-
- $_ .= "
\n" if (!$inpre && $innf);
-
- print TEMP;
- $wrotetext = 1;
- }
-
-# The TOC, if present, will have been written - terminate it
-
-print "