Make kdelibs build in Debian's kFreeBSD. We can not push this patch to upstream since the: CMAKE_SYSTEM_NAME MATCHES kFreeBSD stuff, needs the Debian patched cmake. Index: kde4libs/ConfigureChecks.cmake =================================================================== --- kde4libs.orig/ConfigureChecks.cmake 2015-09-19 02:00:23.881033787 +0200 +++ kde4libs/ConfigureChecks.cmake 2015-09-19 02:00:23.845035240 +0200 @@ -138,11 +138,11 @@ set(UTIL_LIBRARY util) endif (login_in_libutil) endif (NOT login_in_libc) - if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL GNU) + if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL GNU OR CMAKE_SYSTEM_NAME MATCHES kFreeBSD) set (HAVE_UTMPX) - else (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL GNU) + else (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL GNU OR CMAKE_SYSTEM_NAME MATCHES kFreeBSD) check_function_exists(getutxent HAVE_UTMPX) - endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL GNU) + endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin OR CMAKE_SYSTEM_NAME MATCHES GNU/FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL GNU OR CMAKE_SYSTEM_NAME MATCHES kFreeBSD) if (HAVE_UTMPX) set(utmp utmpx) if (login_in_libutil) Index: kde4libs/kio/kfile/kpropertiesdialog.cpp =================================================================== --- kde4libs.orig/kio/kfile/kpropertiesdialog.cpp 2015-09-19 02:00:23.881033787 +0200 +++ kde4libs/kio/kfile/kpropertiesdialog.cpp 2015-09-19 02:00:23.857034756 +0200 @@ -1894,7 +1894,15 @@ fileSystemSupportsACLs = ( statfs( path.data(), &buf ) == 0 ) && ( buf.f_flags & MNT_ACLS ); #else fileSystemSupportsACLs = - getxattr( path.data(), "system.posix_acl_access", NULL, 0 ) >= 0 || errno == ENODATA; + getxattr( path.data(), "system.posix_acl_access", NULL, 0 ) >= 0 +#ifdef ENODATA + || (errno == ENODATA) +#endif +#ifdef ENOATTR + || (errno == ENOATTR) +#endif + ; + #endif return fileSystemSupportsACLs; } Index: kde4libs/kioslave/file/file.cpp =================================================================== --- kde4libs.orig/kioslave/file/file.cpp 2015-09-19 02:00:23.881033787 +0200 +++ kde4libs/kioslave/file/file.cpp 2015-09-19 02:00:23.865034432 +0200 @@ -310,8 +310,10 @@ } #if HAVE_FADVISE +#ifdef POSIX_FADV_SEQUENTIAL posix_fadvise( fd, 0, 0, POSIX_FADV_SEQUENTIAL); #endif +#endif // Determine the mimetype of the file to be retrieved, and emit it. // This is mandatory in all slaves (for KRun/BrowserRun to work) Index: kde4libs/kioslave/file/file_unix.cpp =================================================================== --- kde4libs.orig/kioslave/file/file_unix.cpp 2015-09-19 02:00:23.881033787 +0200 +++ kde4libs/kioslave/file/file_unix.cpp 2015-09-19 02:00:23.869034272 +0200 @@ -145,8 +145,10 @@ } #if HAVE_FADVISE +#ifdef POSIX_FADV_SEQUENTIAL posix_fadvise(src_fd,0,0,POSIX_FADV_SEQUENTIAL); #endif +#endif // WABA: Make sure that we keep writing permissions ourselves, // otherwise we can be in for a surprise on NFS. mode_t initialMode; @@ -168,8 +170,10 @@ } #if HAVE_FADVISE +#ifdef POSIX_FADV_SEQUENTIAL posix_fadvise(dest_fd,0,0,POSIX_FADV_SEQUENTIAL); #endif +#endif #ifdef HAVE_POSIX_ACL acl = acl_get_fd(src_fd); Index: kde4libs/kpty/kpty.cpp =================================================================== --- kde4libs.orig/kpty/kpty.cpp 2015-09-19 02:00:23.881033787 +0200 +++ kde4libs/kpty/kpty.cpp 2015-09-19 02:00:23.881033787 +0200 @@ -109,24 +109,24 @@ # define _NEW_TTY_CTRL #endif -#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) +#if defined(HAVE_TCGETATTR) +# define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode) +#elif defined(TIOCGETA) # define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode) +#elif defined(TCGETS) +# define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode) #else -# if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__) || defined(__sun) -# define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode) -# else -# define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode) -# endif +# error #endif -#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) +#if defined(HAVE_TCSETATTR) && defined(TCSANOW) +# define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode) +#elif defined(TIOCSETA) # define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode) +#elif defined(TCSETS) +# define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode) #else -# if defined(_HPUX_SOURCE) || defined(__CYGWIN__) || defined(__sun) -# define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode) -# else -# define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode) -# endif +# error #endif #include Index: kde4libs/cmake/modules/FindKDE4Internal.cmake =================================================================== --- kde4libs.orig/cmake/modules/FindKDE4Internal.cmake 2015-09-19 02:00:23.881033787 +0200 +++ kde4libs/cmake/modules/FindKDE4Internal.cmake 2015-09-19 02:00:23.881033787 +0200 @@ -1065,7 +1065,7 @@ endif (APPLE) -if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) +if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU OR CMAKE_SYSTEM_NAME MATCHES kFreeBSD) if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set ( _KDE4_PLATFORM_DEFINITIONS -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE) set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}") @@ -1086,7 +1086,7 @@ set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}") set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}") endif (CMAKE_C_COMPILER MATCHES "icc") -endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) +endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU OR CMAKE_SYSTEM_NAME MATCHES kFreeBSD) if (UNIX) set ( _KDE4_PLATFORM_DEFINITIONS "${_KDE4_PLATFORM_DEFINITIONS} -D_LARGEFILE64_SOURCE") @@ -1183,13 +1183,13 @@ # As of Qt 4.6.x we need to override the new exception macros if we want compile with -fno-exceptions set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common") - if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) + if (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU OR CMAKE_SYSTEM_NAME MATCHES kFreeBSD) # This should not be needed, as it is also part of _KDE4_PLATFORM_DEFINITIONS below. # It is kept here nonetheless both for backwards compatibility in case one does not use add_definitions(${KDE4_DEFINITIONS}) # and also because it is/was needed by glibc for snprintf to be available when building C files. # See commit 4a44862b2d178c1d2e1eb4da90010d19a1e4a42c. add_definitions (-D_DEFAULT_SOURCE -D_BSD_SOURCE) - endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) + endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU OR CMAKE_SYSTEM_NAME MATCHES kFreeBSD) if (CMAKE_SYSTEM_NAME STREQUAL GNU) set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")