Cleanuup the cmake patchset for upstream submission.

This commit is contained in:
Adrien Destugues
2013-10-05 17:25:22 +02:00
parent 3694c8d378
commit e8f7702898

View File

@@ -1,44 +1,41 @@
From 7832e4b405ad774c3dae10607707745677723f66 Mon Sep 17 00:00:00 2001
From a88d3007575ab7e79d80d955022d6eb1755e6245 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Tue, 1 Oct 2013 10:36:36 +0200
Subject: Convert existing patch to patchset format.
Date: Sat, 5 Oct 2013 16:26:02 +0200
Subject: Several fixes to Haiku platform module
* This will need cleanup, but it will do for now.
* Do not define BEOS anymore (this includes workarounds which we don't
need most of the time in Haiku, so we prefer opt-in IF(HAIKU) in the
cmake files instead).
* On the other hand, do define UNIX (we are trying to be compliant) and
HAIKU (there is still a number of things we don't do like the
average UNIX clone)
* Do not use UnixPaths, as our filesystem hierarchy isn't anything like
what it expects.
* Do not use -nostart, which the compiler doesn't know about anymore.
This used to be an Haiku extension to gcc, and is equivalent to
-shared which is the default gcc option.
* While "dl" functions are provided in libroot, this is always
implicitly linked so there is no need to tell cmake about it.
* Forcing position-independent code is not needed, so remove it.
* On the other hand, include appropriate linker options for executables
and shared libraries.
* Support for the two available compilers in Haiku (gcc2 and gcc4) and
pick the right headers and libraries according to the currently
selected one.
* With the adoption of the package manager, the directory layout was
changed. Tell cmake where to look for header files and libraries.
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 1df2399..2a68616 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -50,6 +50,7 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
/usr/local/X11R6
/usr/local/X11
/usr/freeware
+ /boot/common/develop/headers
PATH_SUFFIXES include/freetype2 include
)
@@ -61,6 +62,7 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
/usr/local/X11R6
/usr/local/X11
/usr/freeware
+ /boot/common/develop/headers
PATH_SUFFIXES include/freetype2 include
)
@@ -74,6 +76,7 @@ find_library(FREETYPE_LIBRARY
/usr/local/X11R6
/usr/local/X11
/usr/freeware
+ /boot/develop/lib
)
# set the user variables
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index 8987783..3236b58 100644
index 8987783..2f8125d 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -1,20 +1,25 @@
@@ -1,22 +1,123 @@
-set(BEOS 1)
+# process only once
+if(HAIKU)
+ return()
+endif()
+
+set(HAIKU 1)
+set(UNIX 1)
@@ -54,311 +51,7 @@ index 8987783..3236b58 100644
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
-include(Platform/UnixPaths)
-list(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common)
-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/common/include)
-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/common/lib)
-list(APPEND CMAKE_SYSTEM_PROGRAM_PATH /boot/common/bin)
-list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /boot/common/lib)
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ /boot/common/non-packaged
+ /boot/common
+ /boot/system
+ )
+list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+ /boot/common/non-packaged/lib
+ /boot/common/lib
+ /boot/develop/lib/x86
+ )
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty)
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86)
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7cc1522..5d66522 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -26,7 +26,8 @@
#include <algorithm>
#if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
#endif
//----------------------------------------------------------------------
@@ -1263,10 +1264,10 @@ const char* cmCPackGenerator::GetInstallPath()
this->InstallPath += "-";
this->InstallPath += this->GetOption("CPACK_PACKAGE_VERSION");
#elif defined(__HAIKU__)
- BPath dir;
- if (find_directory(B_COMMON_DIRECTORY, &dir) == B_OK)
+ char dir[B_PATH_NAME_LENGTH];
+ if (find_directory(B_COMMON_DIRECTORY, -1, false, dir, sizeof(dir)) == B_OK)
{
- this->InstallPath = dir.Path();
+ this->InstallPath = dir;
}
else
{
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 1cc1754..fcb66a7 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -20,7 +20,8 @@
#include "cmExportBuildFileGenerator.h"
#if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
#endif
cmExportCommand::cmExportCommand()
@@ -305,14 +306,15 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
const char* hash)
{
#if defined(__HAIKU__)
- BPath dir;
- if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) != B_OK)
+ char dir[B_PATH_NAME_LENGTH];
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, dir, sizeof(dir)) !=
+ B_OK)
{
return;
}
- dir.Append("cmake/packages");
- dir.Append(package.c_str());
- std::string fname = dir.Path();
+ std::string fname = dir;
+ fname += "/cmake/packages/";
+ fname += package;
#else
const char* home = cmSystemTools::GetEnv("HOME");
if(!home)
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index aa3a73d..a09958b 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -19,7 +19,9 @@
#endif
#if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <string.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
#endif
void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
@@ -1584,12 +1586,13 @@ void cmFindPackageCommand::AddPrefixesUserRegistry()
#if defined(_WIN32) && !defined(__CYGWIN__)
this->LoadPackageRegistryWinUser();
#elif defined(__HAIKU__)
- BPath dir;
- if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) == B_OK)
+ char dir[B_PATH_NAME_LENGTH];
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, dir, sizeof(dir)) ==
+ B_OK)
{
- dir.Append("cmake/packages");
- dir.Append(this->Name.c_str());
- this->LoadPackageRegistryDir(dir.Path());
+ strlcat(dir, "/cmake/packages/", sizeof(dir));
+ strlcat(dir, this->Name.c_str(), sizeof(dir));
+ this->LoadPackageRegistryDir(dir);
}
#else
if(const char* home = cmSystemTools::GetEnv("HOME"))
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ee5b9d8..ba8faf3 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -37,7 +37,8 @@
#include <assert.h>
#if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
#endif
cmLocalGenerator::cmLocalGenerator()
@@ -354,12 +355,12 @@ void cmLocalGenerator::GenerateInstallRules()
prefix = prefix_win32.c_str();
}
#elif defined(__HAIKU__)
+ char dir[B_PATH_NAME_LENGTH];
if (!prefix)
{
- BPath dir;
- if (find_directory(B_COMMON_DIRECTORY, &dir) == B_OK)
+ if (find_directory(B_COMMON_DIRECTORY, -1, false, dir, sizeof(dir)) == B_OK)
{
- prefix = dir.Path();
+ prefix = dir;
}
else
{
diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt
index 5c43052..f00cbd6 100644
--- a/Tests/ComplexOneConfig/Library/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt
@@ -51,7 +51,7 @@ define_property(
FULL_DOCS "A simple etst proerty that means nothign and is used for nothing"
)
set_target_properties(CMakeTestCLibraryShared PROPERTIES FOO BAR)
-if(NOT BEOS AND NOT WIN32) # No libm on BeOS.
+if(NOT BEOS AND NOT WIN32 AND NOT HAIKU) # No libm on BeOS.
set_target_properties(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
endif()
get_target_property(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
diff --git a/Utilities/cmcurl/CMake/CurlTests.c b/Utilities/cmcurl/CMake/CurlTests.c
index d74a4f0..c5ba7c2 100644
--- a/Utilities/cmcurl/CMake/CurlTests.c
+++ b/Utilities/cmcurl/CMake/CurlTests.c
@@ -38,7 +38,7 @@ main ()
# define PLATFORM_AIX_V3
#endif
-#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || (defined(__BEOS__) && !defined(__HAIKU__))
+#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
#error "O_NONBLOCK does not work on this platform"
#endif
int socket;
diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c
index 51adbcf..82f9dc2 100644
--- a/Utilities/cmcurl/select.c
+++ b/Utilities/cmcurl/select.c
@@ -39,7 +39,7 @@
#error "We can't compile without select() support!"
#endif
-#if defined(__BEOS__) && !defined(__HAIKU__)
+#if defined(__BEOS__)
/* BeOS has FD_SET defined in socket.h */
#include <socket.h>
#endif
diff --git a/Utilities/cmzlib/zconf.h b/Utilities/cmzlib/zconf.h
index 6eb52d1..7a3b6fd 100644
--- a/Utilities/cmzlib/zconf.h
+++ b/Utilities/cmzlib/zconf.h
@@ -237,7 +237,7 @@
# endif
#endif
-#if defined (__BEOS__) && !defined (__HAIKU__)
+#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
--
1.8.3.4
From 305991d869191c373398acc9605d29a92bf2b069 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Wed, 2 Oct 2013 15:22:57 +0200
Subject: Fix include and lib search pathes
* For gcc2, look in the legacy (no arch) direcotry.
* For gcc4, look inthe the platform dir (currently hardcoded to x86)
* This was tested only on gcc2hybrid. I'm not sure it matches other
platforms.
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index 3236b58..dfb3526 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -10,18 +10,33 @@ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+# FIXME need to detect if we are on gcc4 or gcc4hybrid, the path are different
+if(CMAKE_C_COMPILER_VERSION VERSION_LESS 3.0.0)
+ # Use gcc2 libs
+ set(__HAIKU_LIBDIR_SUFFIX "")
+else()
+ # Use gcc4 libs
+ set(__HAIKU_LIBDIR_SUFFIX "/x86")
+endif()
+
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
/boot/common/non-packaged
/boot/common
/boot/system
)
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
- /boot/common/non-packaged/lib
- /boot/common/lib
- /boot/develop/lib/x86
+ /boot/common/non-packaged/lib${__HAIKU_LIBDIR_SUFFIX}
+ /boot/common/develop/lib${__HAIKU_LIBDIR_SUFFIX}
+ /boot/system/develop/lib${__HAIKU_LIBDIR_SUFFIX}
+ )
+list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+ /boot/common/develop/headers${__HAIKU_LIBDIR_SUFFIX}
+ /boot/system/develop/headers${__HAIKU_LIBDIR_SUFFIX}
+ )
+list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+ /boot/common/develop/lib${__HAIKU_LIBDIR_SUFFIX}
+ /boot/system/develop/lib${__HAIKU_LIBDIR_SUFFIX}
)
-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty)
-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH
--
1.8.3.4
From be0844f3d3b16856732f3336053896df077d3317 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 3 Oct 2013 08:40:31 +0200
Subject: Merge changes from our CMake 2.8.5 patchset
* This one had already been modified for better PM support.
* Also includes some cleanups, which we should upstream
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index a2bf0c0..770e93a 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -54,7 +54,7 @@ find_library(LUA_LIBRARY
if(LUA_LIBRARY)
# include the math library for Unix
- if(UNIX AND NOT APPLE AND NOT BEOS)
+ if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index dfb3526..2f8125d 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -1,3 +1,8 @@
+# process only once
+if(HAIKU)
+ return()
+endif()
+
set(HAIKU 1)
set(UNIX 1)
@@ -10,34 +15,110 @@ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
-# FIXME need to detect if we are on gcc4 or gcc4hybrid, the path are different
-if(CMAKE_C_COMPILER_VERSION VERSION_LESS 3.0.0)
- # Use gcc2 libs
- set(__HAIKU_LIBDIR_SUFFIX "")
-else()
- # Use gcc4 libs
- set(__HAIKU_LIBDIR_SUFFIX "/x86")
+# Determine, if the C or C++ compiler is configured for a secondary
+# architecture. If so, that will change the search paths we set below. We check
+# whether the compiler's library search paths contain a
@@ -369,8 +62,8 @@ index dfb3526..2f8125d 100644
+
+if("${__HAIKU_COMPILER}" STREQUAL "")
+ set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER})
endif()
+endif()
+
+execute_process(
+ COMMAND ${__HAIKU_COMPILER} -print-search-dirs
+ COMMAND sed -ne "/^libraries:/!d; s,libraries: =*\\(.*\\):,\\1,; s,:,\\n,gp"
@@ -396,15 +89,11 @@ index dfb3526..2f8125d 100644
+ set(CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH})
+endif("${CMAKE_HAIKU_SECONDARY_ARCH}" STREQUAL "")
+
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
/boot/common/non-packaged
/boot/common
/boot/system
)
-list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
- /boot/common/non-packaged/lib${__HAIKU_LIBDIR_SUFFIX}
- /boot/common/develop/lib${__HAIKU_LIBDIR_SUFFIX}
- /boot/system/develop/lib${__HAIKU_LIBDIR_SUFFIX}
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ /boot/common/non-packaged
+ /boot/common
+ /boot/system
+ )
+
+LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
+ /boot/common/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
@@ -448,10 +137,7 @@ index dfb3526..2f8125d 100644
+
+LIST(APPEND CMAKE_HAIKU_C_INCLUDE_DIRECTORIES
+ ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES}
)
-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
- /boot/common/develop/headers${__HAIKU_LIBDIR_SUFFIX}
- /boot/system/develop/headers${__HAIKU_LIBDIR_SUFFIX}
+ )
+
+LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES
+ ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES})
@@ -462,51 +148,133 @@ index dfb3526..2f8125d 100644
+ /boot/common/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/common/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
)
-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
- /boot/common/develop/lib${__HAIKU_LIBDIR_SUFFIX}
- /boot/system/develop/lib${__HAIKU_LIBDIR_SUFFIX}
+ )
+
+LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+ ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES}
)
+ )
-include(Platform/UnixPaths)
-list(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common)
-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/common/include)
-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/common/lib)
-list(APPEND CMAKE_SYSTEM_PROGRAM_PATH /boot/common/bin)
-list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /boot/common/lib)
-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty)
-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86)
+LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES})
+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 322a6a2..2aaedec 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -53,14 +53,10 @@
#include <cm_zlib.h>
#include <cmsys/Base64.h>
--
1.8.3.4
From c34471ea6e9b64d962ba385df0f1dee078b8ba77 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 5 Oct 2013 16:31:36 +0200
Subject: Remove use of B_COMMON_DIRECTORY
* The common directory was removed in Haiku. Applications are now
installed in the system directory.
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7cc1522..de394a6 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -26,7 +26,8 @@
#include <algorithm>
-#if defined(__BEOS__)
+#if defined(__BEOS__) || defined(__HAIKU__)
#include <be/kernel/OS.h> /* disable_debugger() API. */
#if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
#endif
-#if defined(__HAIKU__)
-#include <os/kernel/OS.h> /* disable_debugger() API. */
-#endif
-
//----------------------------------------------------------------------
@@ -1263,14 +1264,14 @@ const char* cmCPackGenerator::GetInstallPath()
this->InstallPath += "-";
this->InstallPath += this->GetOption("CPACK_PACKAGE_VERSION");
#elif defined(__HAIKU__)
- BPath dir;
- if (find_directory(B_COMMON_DIRECTORY, &dir) == B_OK)
+ char dir[B_PATH_NAME_LENGTH];
+ if (find_directory(B_SYSTEM_DIRECTORY, -1, false, dir, sizeof(dir)) == B_OK)
{
- this->InstallPath = dir.Path();
+ this->InstallPath = dir;
}
else
{
- this->InstallPath = "/boot/common";
+ this->InstallPath = "/boot/system";
}
#else
this->InstallPath = "/usr/local/";
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 1cc1754..fcb66a7 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -20,7 +20,8 @@
#include "cmExportBuildFileGenerator.h"
#define DEBUGOUT std::cout << __LINE__ << " "; std::cout
#define DEBUGERR std::cerr << __LINE__ << " "; std::cerr
#if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
#endif
cmExportCommand::cmExportCommand()
@@ -305,14 +306,15 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
const char* hash)
{
#if defined(__HAIKU__)
- BPath dir;
- if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) != B_OK)
+ char dir[B_PATH_NAME_LENGTH];
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, dir, sizeof(dir)) !=
+ B_OK)
{
return;
}
- dir.Append("cmake/packages");
- dir.Append(package.c_str());
- std::string fname = dir.Path();
+ std::string fname = dir;
+ fname += "/cmake/packages/";
+ fname += package;
#else
const char* home = cmSystemTools::GetEnv("HOME");
if(!home)
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index a09958b..6dd2f49 100644
index aa3a73d..6dd2f49 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1590,9 +1590,10 @@ void cmFindPackageCommand::AddPrefixesUserRegistry()
if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, dir, sizeof(dir)) ==
B_OK)
{
- strlcat(dir, "/cmake/packages/", sizeof(dir));
- strlcat(dir, this->Name.c_str(), sizeof(dir));
- this->LoadPackageRegistryDir(dir);
@@ -19,7 +19,9 @@
#endif
#if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <string.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
#endif
void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
@@ -1584,12 +1586,14 @@ void cmFindPackageCommand::AddPrefixesUserRegistry()
#if defined(_WIN32) && !defined(__CYGWIN__)
this->LoadPackageRegistryWinUser();
#elif defined(__HAIKU__)
- BPath dir;
- if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) == B_OK)
- {
- dir.Append("cmake/packages");
- dir.Append(this->Name.c_str());
- this->LoadPackageRegistryDir(dir.Path());
+ char dir[B_PATH_NAME_LENGTH];
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, dir, sizeof(dir)) ==
+ B_OK)
+ {
+ std::string fname = dir;
+ fname += "/cmake/packages/";
+ fname += Name;
@@ -514,6 +282,55 @@ index a09958b..6dd2f49 100644
}
#else
if(const char* home = cmSystemTools::GetEnv("HOME"))
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ee5b9d8..1369dab 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -37,7 +37,8 @@
#include <assert.h>
#if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
#endif
cmLocalGenerator::cmLocalGenerator()
@@ -354,16 +355,16 @@ void cmLocalGenerator::GenerateInstallRules()
prefix = prefix_win32.c_str();
}
#elif defined(__HAIKU__)
+ char dir[B_PATH_NAME_LENGTH];
if (!prefix)
{
- BPath dir;
- if (find_directory(B_COMMON_DIRECTORY, &dir) == B_OK)
+ if (find_directory(B_SYSTEM_DIRECTORY, -1, false, dir, sizeof(dir)) == B_OK)
{
- prefix = dir.Path();
+ prefix = dir;
}
else
{
- prefix = "/boot/common";
+ prefix = "/boot/system";
}
}
#else
--
1.8.3.4
From bdcc8b10fde413e121e4a043210a5a477db51232 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 5 Oct 2013 16:33:52 +0200
Subject: Remove useless preprocessor checks
* Haiku does not define __BEOS__ anymore, so there is no need to guard
these BeOS specific workaround for Haiku.
* The workaround themselves are not needed for Haiku as it has much
better POSIX compatibility than BeOS did.
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 8b25d60..51dba3c 100644
--- a/Source/kwsys/SystemTools.cxx
@@ -530,39 +347,45 @@ index 8b25d60..51dba3c 100644
#if defined(__BEOS__) && !defined(__ZETA__)
#include <be/kernel/OS.h>
#include <be/storage/Path.h>
diff --git a/Source/kwsys/testDynamicLoader.cxx b/Source/kwsys/testDynamicLoader.cxx
index 61c1572..fc0215e 100644
--- a/Source/kwsys/testDynamicLoader.cxx
+++ b/Source/kwsys/testDynamicLoader.cxx
@@ -15,14 +15,10 @@
#include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(stl/string)
-#if defined(__BEOS__)
+#if defined(__BEOS__) || defined(__HAIKU__)
#include <be/kernel/OS.h> /* disable_debugger() API. */
diff --git a/Utilities/cmcurl/CMake/CurlTests.c b/Utilities/cmcurl/CMake/CurlTests.c
index d74a4f0..c5ba7c2 100644
--- a/Utilities/cmcurl/CMake/CurlTests.c
+++ b/Utilities/cmcurl/CMake/CurlTests.c
@@ -38,7 +38,7 @@ main ()
# define PLATFORM_AIX_V3
#endif
-#if defined(__HAIKU__)
-#include <os/kernel/OS.h> /* disable_debugger() API. */
-#endif
-
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt
index 5c43052..f00cbd6 100644
--- a/Tests/Complex/Library/CMakeLists.txt
+++ b/Tests/Complex/Library/CMakeLists.txt
@@ -51,7 +51,7 @@ define_property(
FULL_DOCS "A simple etst proerty that means nothign and is used for nothing"
)
set_target_properties(CMakeTestCLibraryShared PROPERTIES FOO BAR)
-if(NOT BEOS AND NOT WIN32) # No libm on BeOS.
+if(NOT BEOS AND NOT WIN32 AND NOT HAIKU) # No libm on BeOS.
set_target_properties(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
endif()
get_target_property(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
-#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || (defined(__BEOS__) && !defined(__HAIKU__))
+#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
#error "O_NONBLOCK does not work on this platform"
#endif
int socket;
diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c
index 51adbcf..82f9dc2 100644
--- a/Utilities/cmcurl/select.c
+++ b/Utilities/cmcurl/select.c
@@ -39,7 +39,7 @@
#error "We can't compile without select() support!"
#endif
-#if defined(__BEOS__) && !defined(__HAIKU__)
+#if defined(__BEOS__)
/* BeOS has FD_SET defined in socket.h */
#include <socket.h>
#endif
diff --git a/Utilities/cmzlib/zconf.h b/Utilities/cmzlib/zconf.h
index 6eb52d1..7a3b6fd 100644
--- a/Utilities/cmzlib/zconf.h
+++ b/Utilities/cmzlib/zconf.h
@@ -237,7 +237,7 @@
# endif
#endif
-#if defined (__BEOS__) && !defined (__HAIKU__)
+#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
diff --git a/Utilities/cmzlib/zutil.h b/Utilities/cmzlib/zutil.h
index 74ef1f8..3053cd8 100644
--- a/Utilities/cmzlib/zutil.h
@@ -583,3 +406,130 @@ index 74ef1f8..3053cd8 100644
--
1.8.3.4
From b961fef182ea636dfd6411d2c82eac25349888f5 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 5 Oct 2013 16:58:24 +0200
Subject: Guard references to libm for Haiku
* The math functionality is defined in libroot, and needs no compiler
or linker flags.
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index a2bf0c0..770e93a 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -54,7 +54,7 @@ find_library(LUA_LIBRARY
if(LUA_LIBRARY)
# include the math library for Unix
- if(UNIX AND NOT APPLE AND NOT BEOS)
+ if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt
index 5c43052..f00cbd6 100644
--- a/Tests/Complex/Library/CMakeLists.txt
+++ b/Tests/Complex/Library/CMakeLists.txt
@@ -51,7 +51,7 @@ define_property(
FULL_DOCS "A simple etst proerty that means nothign and is used for nothing"
)
set_target_properties(CMakeTestCLibraryShared PROPERTIES FOO BAR)
-if(NOT BEOS AND NOT WIN32) # No libm on BeOS.
+if(NOT BEOS AND NOT WIN32 AND NOT HAIKU) # No libm on BeOS.
set_target_properties(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
endif()
get_target_property(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt
index 5c43052..f00cbd6 100644
--- a/Tests/ComplexOneConfig/Library/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt
@@ -51,7 +51,7 @@ define_property(
FULL_DOCS "A simple etst proerty that means nothign and is used for nothing"
)
set_target_properties(CMakeTestCLibraryShared PROPERTIES FOO BAR)
-if(NOT BEOS AND NOT WIN32) # No libm on BeOS.
+if(NOT BEOS AND NOT WIN32 AND NOT HAIKU) # No libm on BeOS.
set_target_properties(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
endif()
get_target_property(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
--
1.8.3.4
From 8f80d0a8eeab5c84580df671da838935244ab821 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 5 Oct 2013 16:59:25 +0200
Subject: Include files cleanup
* No need to use a different path from the BeOS one, which still works.
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 322a6a2..2aaedec 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -53,14 +53,10 @@
#include <cm_zlib.h>
#include <cmsys/Base64.h>
-#if defined(__BEOS__)
+#if defined(__BEOS__) || defined(__HAIKU__)
#include <be/kernel/OS.h> /* disable_debugger() API. */
#endif
-#if defined(__HAIKU__)
-#include <os/kernel/OS.h> /* disable_debugger() API. */
-#endif
-
#define DEBUGOUT std::cout << __LINE__ << " "; std::cout
#define DEBUGERR std::cerr << __LINE__ << " "; std::cerr
diff --git a/Source/kwsys/testDynamicLoader.cxx b/Source/kwsys/testDynamicLoader.cxx
index 61c1572..fc0215e 100644
--- a/Source/kwsys/testDynamicLoader.cxx
+++ b/Source/kwsys/testDynamicLoader.cxx
@@ -15,14 +15,10 @@
#include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(stl/string)
-#if defined(__BEOS__)
+#if defined(__BEOS__) || defined(__HAIKU__)
#include <be/kernel/OS.h> /* disable_debugger() API. */
#endif
-#if defined(__HAIKU__)
-#include <os/kernel/OS.h> /* disable_debugger() API. */
-#endif
-
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
--
1.8.3.4
From 05430f6597e12ac70218e34829f2805568f50194 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 5 Oct 2013 17:01:03 +0200
Subject: FindSDL: Fix broken include paths
* I asked the CMake community about this, and they couldn't even figure
out how this worked even on other platforms.
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index fec142e..6adec1f 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -70,7 +70,7 @@
find_path(SDL_INCLUDE_DIR SDL.h
HINTS
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL SDL12 SDL11
)
# SDL-1.1 is the name used by FreeBSD ports...
--
1.8.3.4