From 7da249e60fd8c4e716cfe97a689cf584a16bd9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Wed, 9 Sep 2015 21:54:47 +0200 Subject: [PATCH] fish-shell: fix cross building --- srcpkgs/fish-shell/files/no-glibc-check.patch | 141 ++++++++++++++++++ srcpkgs/fish-shell/template | 15 +- 2 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/fish-shell/files/no-glibc-check.patch diff --git a/srcpkgs/fish-shell/files/no-glibc-check.patch b/srcpkgs/fish-shell/files/no-glibc-check.patch new file mode 100644 index 00000000000..53bec9ebb35 --- /dev/null +++ b/srcpkgs/fish-shell/files/no-glibc-check.patch @@ -0,0 +1,141 @@ +Remove configure tests which fail when cross building. + +--- configure.ac.orig 2015-09-09 21:49:50.021403972 +0200 ++++ configure.ac 2015-09-09 21:50:04.759403929 +0200 +@@ -226,49 +226,6 @@ + esac + + # +-# If we are compiling against glibc, set some flags to work around +-# some rather stupid attempts to hide prototypes for *wprintf +-# functions, as well as prototypes of various gnu extensions. +-# +- +-AC_MSG_CHECKING([if we are compiling against glibc]) +-AC_RUN_IFELSE( +- [ +- AC_LANG_PROGRAM( +- [ +- #include +- #ifdef __GLIBC__ +- #define STATUS 0 +- #else +- #define STATUS 1 +- #endif +- ], +- [ +- return STATUS; +- ] +- ) +- ], +- [glibc=yes], +- [glibc=no] +-) +- +-if test "$glibc" = yes; then +- AC_MSG_RESULT(yes) +- +- # +- # This gives us access to prototypes for gnu extensions and C99 +- # functions if we are compiling agains glibc. All GNU extensions +- # that are used must have a fallback implementation available in +- # fallback.h, in order to keep fish working on non-gnu platforms. +- # +- +- CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE=1 -D_ISO99_SOURCE=1" +-else +- AC_MSG_RESULT(no) +-fi +- +- +-# + # Test cpu for special handling of ppc + # + # This is used to skip use of tputs on ppc systems, since it seemed to +@@ -537,44 +494,6 @@ + + + # +-# Check if realpath accepts null for its second argument +-# +- +-AC_MSG_CHECKING([if realpath accepts null for its second argument]) +-AC_RUN_IFELSE( +- [ +- AC_LANG_PROGRAM( +- [ +- #include +- #include +- #include +- ], +- [ +- int status; +- char *res; +- res = realpath( "somefile", 0 ); +- status = !(res != 0 || errno == ENOENT); +- exit( status ); +- ] +- ) +- ], +- [have_realpath_null=yes], +- [have_realpath_null=no] +-) +- +-if test "$have_realpath_null" = yes; then +- AC_MSG_RESULT(yes) +- AC_DEFINE( +- [HAVE_REALPATH_NULL], +- [1], +- [Define to 1 if realpath accepts null for its second argument.] +- ) +-else +- AC_MSG_RESULT(no) +-fi +- +- +-# + # Check if struct winsize and TIOCGWINSZ exist + # + +@@ -607,41 +526,6 @@ + ) + + +-# +-# If we have a fwprintf in libc, test that it actually works. As of +-# March 2006, it is broken under DragonFly BSD. +-# +- +-if test "$ac_cv_func_fwprintf" = yes; then +- +- AC_MSG_CHECKING([if fwprintf is broken]) +- AC_RUN_IFELSE( +- [ +- AC_LANG_PROGRAM( +- [ +- #include +- #include +- #include +- #include +- ], +- [ +- setlocale( LC_ALL, "" ); +- fwprintf( stderr, L"%ls%ls", L"", L"fish:" ); +- ] +- ) +- ], +- [ +- AC_MSG_RESULT(no) +- ], +- [ +- AC_MSG_RESULT([yes]) +- AC_DEFINE([HAVE_BROKEN_FWPRINTF], [1], [Define to 1 one if the implemented fwprintf is broken]) +- ] +- ) +- +-fi +- +- + # Check for _nl_msg_cat_cntr symbol + AC_MSG_CHECKING([for _nl_msg_cat_cntr symbol]) + AC_TRY_LINK( diff --git a/srcpkgs/fish-shell/template b/srcpkgs/fish-shell/template index 71668281529..f1afbb8252f 100644 --- a/srcpkgs/fish-shell/template +++ b/srcpkgs/fish-shell/template @@ -1,7 +1,7 @@ # Template file for 'fish-shell' pkgname=fish-shell version=2.2.0 -revision=2 +revision=3 build_style=gnu-configure hostmakedepends="automake" makedepends="ncurses-devel" @@ -15,6 +15,19 @@ short_desc="User friendly shell intended mostly for interactive use" distfiles="http://fishshell.com/files/${version}/fish-${version}.tar.gz" checksum=a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a +if [ -n "$CROSS_BUILD" ]; then + case "$XBPS_TARGET_MACHINE" in + *-musl) # Nothing to add + ;; + *) # Add CXXFLAGS required for glibc + CXXFLAGS="-D_GNU_SOURCE=1 -D_ISO99_SOURCE=1" + ;; + esac + export ac_cv_file__proc_self_stat=yes +fi pre_configure() { + if [ -n "$CROSS_BUILD" ]; then + patch -p0 < ${FILESDIR}/no-glibc-check.patch + fi autoreconf -fi }