FreeBSD 12.4 php 7.1 ソースコンパイル

php-7.1.33

(FreeBSD 13も同様)

freetype (--with-freetype-dir)

configure: error: freetype-config not found.

https://bugs.gentoo.org/654794

pkg install pkgconf

して
php-freetype-2.9.1.patch を適用する

https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-lang/php/files/php-freetype-2.9.1.patch?id=71ef0a9d7feaa6bc13c22a33267a1bd496d98e8d

cd php-7.1.33
patch -p1 < php-freetype-2.9.1.patch

(php 5.4も同様)

intl (--enable-intl)

use of undeclared identifier 'TRUE'

https://bbs.archlinux.org/viewtopic.php?id=263464
https://bugs.php.net/bug.php?id=80310

configure のINTL_COMMON_FLAGSに -DU_DEFINE_FALSE_AND_TRUE=1 を追加

-  INTL_COMMON_FLAGS="$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
+  INTL_COMMON_FLAGS="$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DU_DEFINE_FALSE_AND_TRUE=1"

5.6 configure

-  ac_extra=`echo "$ICU_INCS -Wno-write-strings"|$SED s#@ext_srcdir@#$ext_srcdir#g|$SED s#@ext_builddir@#$ext_builddir#g`
+  ac_extra=`echo "$ICU_INCS -Wno-write-strings -DU_DEFINE_FALSE_AND_TRUE=1"|$SED s#@ext_srcdir@#$ext_srcdir#g|$SED s#@ext_builddir@#$ext_builddir#g`

icu-72

https://cgit.freebsd.org/ports/commit/?id=2c2eb4692242d0f7c9e125920a712bc8f4ec0154

ext/intl/breakiterator/codepointiterator_internal.cpp

+#if U_ICU_VERSION_MAJOR_NUM < 70
 UBool CodePointBreakIterator::operator==(const BreakIterator& that) const
+#else
+bool CodePointBreakIterator::operator==(const BreakIterator& that) const
+#endif

ext/intl/breakiterator/codepointiterator_internal.h

+#if U_ICU_VERSION_MAJOR_NUM < 70
 		virtual UBool operator==(const BreakIterator& that) const;
+#else
+		virtual bool operator==(const BreakIterator& that) const;
+#endif

https://github.com/php/php-src/pull/7596

https://github.com/openwrt/packages/pull/17046

https://github.com/nxhack/packages/blob/bc13112a7c180dfad51db065c74438017fc8a8c7/lang/php7/patches/1011-Accommodate-changes-to-canonicalized-forms-in-ICU-70_1.patch

1011-Accommodate-changes-to-canonicalized-forms-in-ICU-70_1.patch を適用する

curl -O https://raw.githubusercontent.com/nxhack/packages/bc13112a7c180dfad51db065c74438017fc8a8c7/lang/php7/patches/1011-Accommodate-changes-to-canonicalized-forms-in-ICU-70_1.patch

patch -p1 < 1011-Accommodate-changes-to-canonicalized-forms-in-ICU-70_1.patch

locale_methods.c.rej 手修正

(FreeBSD 13)

ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1756 (/usr/local/lib/gcc9/include/c++/bits/stl_vector.h:1756)
>>>               ext/intl/msgformat/.libs/msgformat_helpers.o:(std::vector<icu::Formattable, std::allocator<icu::Formattable> >::_M_default_append(unsigned long))

ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1756 (/usr/local/lib/gcc9/include/c++/bits/stl_vector.h:1756)
>>>               ext/intl/msgformat/.libs/msgformat_helpers.o:(std::vector<icu::UnicodeString, std::allocator<icu::UnicodeString> >::_M_default_append(unsigned long))
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.

https://forums.freebsd.org/threads/custom-php-static-build-issue-with-intl.72167/

このエラーが出る場合gccを指定する

CC=gcc ./configure

ports

/usr/ports/devel/php80-intl/Makefile 
...
USES=           compiler:c++11-lib
USE_CXXSTD=     gnu++11

https://docs.freebsd.org/en/books/porters-handbook/uses/
https://github.com/freebsd/freebsd-ports/blob/main/Mk/Uses/compiler.mk

USESマクロ → gcc

make test

https://bugs.php.net/bug.php?id=78090

bug45161.phpt takes forever to finish

patch -p1 < 5146.patch