diff --git a/dev-util/cmake/patches/cmake-2.8.11.2.patch b/dev-util/cmake/patches/cmake-2.8.11.2.patch deleted file mode 100644 index 6b3bd2f94..000000000 --- a/dev-util/cmake/patches/cmake-2.8.11.2.patch +++ /dev/null @@ -1,249 +0,0 @@ -diff -urN cmake-2.8.11.2-orig/Modules/Platform/Haiku.cmake cmake-2.8.11.2/Modules/Platform/Haiku.cmake ---- cmake-2.8.11.2-orig/Modules/FindFreetype.cmake 2012-11-27 13:26:32.037486592 +0000 -+++ cmake-2.8.11.2/Modules/FindFreetype.cmake 2013-02-10 23:15:25.000000000 +0000 -@@ -46,20 +46,22 @@ - HINTS - ENV FREETYPE_DIR - PATHS -+ /boot/develop/headers - /usr/local/X11R6 - /usr/local/X11 - /usr/freeware -- PATH_SUFFIXES include/freetype2 include -+ PATH_SUFFIXES include/freetype2 include 3rdparty - ) - - find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h - HINTS - ENV FREETYPE_DIR - PATHS -+ /boot/develop/headers - /usr/local/X11R6 - /usr/local/X11 - /usr/freeware -- PATH_SUFFIXES include/freetype2 include -+ PATH_SUFFIXES include/freetype2 include 3rdparty/freetype2 3rdparty - ) - - find_library(FREETYPE_LIBRARY -@@ -68,6 +70,7 @@ - ENV FREETYPE_DIR - PATH_SUFFIXES lib - PATHS -+ /boot/system/lib - /usr/local/X11R6 - /usr/local/X11 - /usr/freeware - ---- cmake-2.8.11.2-orig/Modules/Platform/Haiku.cmake 2012-12-03 12:11:47.804519936 -0800 -+++ cmake-2.8.11.2/Modules/Platform/Haiku.cmake 2012-12-03 12:02:17.652738560 -0800 -@@ -1,20 +1,25 @@ -+set(HAIKU 1) -+set(UNIX 1) -+ -+set(CMAKE_DL_LIBS "") --set(BEOS 1) -- --set(CMAKE_DL_LIBS root be) --set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") --set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") - set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") -+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") --set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -+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") -+ -+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 -+ ) -- --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) - -diff -urN cmake-2.8.11.2-orig/Source/cmExportCommand.cxx cmake-2.8.11.2/Source/cmExportCommand.cxx ---- cmake-2.8.11.2-orig/Source/cmExportCommand.cxx 2012-11-27 05:26:33.039059456 -0800 -+++ cmake-2.8.11.2/Source/cmExportCommand.cxx 2012-12-03 12:02:17.665059328 -0800 -@@ -20,7 +20,8 @@ - #include "cmExportBuildFileGenerator.h" - - #if defined(__HAIKU__) --#include -+#include -+#include - #endif - - cmExportCommand::cmExportCommand() -@@ -305,14 +306,15 @@ - 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 -urN cmake-2.8.11.2-orig/Source/cmFindPackageCommand.cxx cmake-2.8.11.2/Source/cmFindPackageCommand.cxx ---- cmake-2.8.11.2-orig/Source/cmFindPackageCommand.cxx 2012-11-27 05:26:33.059768832 -0800 -+++ cmake-2.8.11.2/Source/cmFindPackageCommand.cxx 2012-12-03 12:02:17.666107904 -0800 -@@ -19,7 +19,9 @@ - #endif - - #if defined(__HAIKU__) --#include -+#include -+#include -+#include - #endif - - void cmFindPackageNeedBackwardsCompatibility(const std::string& variable, -@@ -1583,12 +1585,13 @@ - #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 -urN cmake-2.8.11.2-orig/Source/cmLocalGenerator.cxx cmake-2.8.11.2/Source/cmLocalGenerator.cxx ---- cmake-2.8.11.2-orig/Source/cmLocalGenerator.cxx 2012-11-27 05:26:33.035389440 -0800 -+++ cmake-2.8.11.2/Source/cmLocalGenerator.cxx 2012-12-03 12:02:17.672399360 -0800 -@@ -37,7 +37,8 @@ - #include - - #if defined(__HAIKU__) --#include -+#include -+#include - #endif - - cmLocalGenerator::cmLocalGenerator() -@@ -354,12 +355,12 @@ - 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 -urN cmake-2.8.11.2-orig/Source/CPack/cmCPackGenerator.cxx cmake-2.8.11.2/Source/CPack/cmCPackGenerator.cxx ---- cmake-2.8.11.2-orig/Source/CPack/cmCPackGenerator.cxx 2012-11-27 05:26:32.015466496 -0800 -+++ cmake-2.8.11.2/Source/CPack/cmCPackGenerator.cxx 2012-12-03 12:02:17.677904384 -0800 -@@ -27,7 +27,8 @@ - #include - - #if defined(__HAIKU__) --#include -+#include -+#include - #endif - - //---------------------------------------------------------------------- -@@ -1265,10 +1266,10 @@ - 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 -urN cmake-2.8.11.2-orig/Tests/ComplexOneConfig/Library/CMakeLists.txt cmake-2.8.11.2/Tests/ComplexOneConfig/Library/CMakeLists.txt ---- cmake-2.8.11.2-orig/Tests/ComplexOneConfig/Library/CMakeLists.txt 2012-11-27 05:26:34.013369344 -0800 -+++ cmake-2.8.11.2/Tests/ComplexOneConfig/Library/CMakeLists.txt 2012-12-03 12:02:42.181665792 -0800 -@@ -51,7 +51,7 @@ - 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 -urN cmake-2.8.11.2-orig/Utilities/cmcurl/CMake/CurlTests.c cmake-2.8.11.2/Utilities/cmcurl/CMake/CurlTests.c ---- cmake-2.8.11.2-orig/Utilities/cmcurl/CMake/CurlTests.c 2012-11-27 05:26:34.045350912 -0800 -+++ cmake-2.8.11.2/Utilities/cmcurl/CMake/CurlTests.c 2012-12-03 12:02:42.189005824 -0800 -@@ -38,7 +38,7 @@ - # 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 -urN cmake-2.8.11.2-orig/Utilities/cmcurl/select.c cmake-2.8.11.2/Utilities/cmcurl/select.c ---- cmake-2.8.11.2-orig/Utilities/cmcurl/select.c 2012-11-27 05:26:34.055312384 -0800 -+++ cmake-2.8.11.2/Utilities/cmcurl/select.c 2012-12-03 12:02:42.189792256 -0800 -@@ -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 - #endif -diff -urN cmake-2.8.11.2-orig/Utilities/cmzlib/zconf.h cmake-2.8.11.2/Utilities/cmzlib/zconf.h ---- cmake-2.8.11.2-orig/Utilities/cmzlib/zconf.h 2012-11-27 05:26:34.022020096 -0800 -+++ cmake-2.8.11.2/Utilities/cmzlib/zconf.h 2012-12-03 12:02:42.190578688 -0800 -@@ -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/dev-util/cmake/patches/cmake-2.8.11.2.patchset b/dev-util/cmake/patches/cmake-2.8.11.2.patchset index 11b7db37d..08789c1ef 100644 --- a/dev-util/cmake/patches/cmake-2.8.11.2.patchset +++ b/dev-util/cmake/patches/cmake-2.8.11.2.patchset @@ -1,4 +1,4 @@ -From 2e3be20216cac12e4e6ace37d132bdc0b5b68b21 Mon Sep 17 00:00:00 2001 +From b9cf2352503777e90fec9db9416f4bf6c793b1f4 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 5 Oct 2013 16:26:02 +0200 Subject: Several fixes to Haiku platform module @@ -212,7 +212,7 @@ index 5c43052..f00cbd6 100644 1.8.3.4 -From e1f3d70eb59d4e87438c2b792a0d64dc2805218d Mon Sep 17 00:00:00 2001 +From 99381ca06fb2d010a7b12ec413855f1c3a99c2c8 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 5 Oct 2013 16:31:36 +0200 Subject: Remove use of B_COMMON_DIRECTORY @@ -363,7 +363,7 @@ index ee5b9d8..1369dab 100644 1.8.3.4 -From a2d6be58cf08774f05427d90de2c0ed7179d16e3 Mon Sep 17 00:00:00 2001 +From c9b1d5be9feb7d1d22f4aa6ef83edd4fb62ff97d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 5 Oct 2013 16:33:52 +0200 Subject: Remove useless preprocessor checks @@ -449,7 +449,7 @@ index 74ef1f8..3053cd8 100644 1.8.3.4 -From abc2262574468318d404a9d4271a818926aab507 Mon Sep 17 00:00:00 2001 +From 22ebddf5e418d248b74a966096e7c75400dba422 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 5 Oct 2013 16:59:25 +0200 Subject: Include files cleanup @@ -500,7 +500,7 @@ index 61c1572..fc0215e 100644 1.8.3.4 -From b932917065447fbd619e642a67ab294a17ffc97c Mon Sep 17 00:00:00 2001 +From 81f62c78a541298c4f989eade02bf48f8206fab2 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 5 Oct 2013 17:01:03 +0200 Subject: FindSDL: Fix broken include paths @@ -525,7 +525,7 @@ index fec142e..6adec1f 100644 1.8.3.4 -From ff28e08e29c0d54d794185ada1ddf496b41285e0 Mon Sep 17 00:00:00 2001 +From fd48834c43e75c3b151afb046f3a9025ab29adb7 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 14 Oct 2013 09:35:02 +0200 Subject: Enable command-line length limitation on Haiku. @@ -547,3 +547,708 @@ index 7e48cd7..3d15900 100644 -- 1.8.3.4 + +From f37bdac542180d045d1bf213ee6d78ed0f46684a Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Thu, 17 Oct 2013 19:27:38 +0200 +Subject: Enable ELF support on Haiku + + * The Ninja build system can't work with CPack when this is missing + * This is used to modify ELF files and change the rpath inside them +when installing or packaging them. + +diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt +index f0519fe..7dc55db 100644 +--- a/Source/CMakeLists.txt ++++ b/Source/CMakeLists.txt +@@ -15,7 +15,14 @@ CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H) + if(HAVE_ELF_H) + set(CMAKE_USE_ELF_PARSER 1) + else() +- set(CMAKE_USE_ELF_PARSER) ++ # Non-standard filename for Haiku, works all the same ++ CHECK_INCLUDE_FILE("elf32.h" HAVE_ELF32_H ++ "-I/system/develop/headers/private/system -I/system/develop/headers/private/system/arch/x86") ++ if(HAVE_ELF32_H) ++ set(CMAKE_USE_ELF_PARSER 1) ++ else() ++ set(CMAKE_USE_ELF_PARSER) ++ endif() + endif() + + set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) +@@ -400,6 +407,14 @@ if(APPLE) + target_link_libraries(CMakeLib "-framework CoreFoundation") + endif() + ++# On Haiku, elf32.h is hidden in the "private" include dir ++if(HAIKU) ++ include_directories( ++ "/system/develop/headers/private/system" ++ "/system/develop/headers/private/system/arch/x86" ++ ) ++endif() ++ + # On some platforms we need the rpcrt4 library for the VS 7 generators. + if(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) + target_link_libraries(CMakeLib rpcrt4) +@@ -505,6 +520,12 @@ if(UNIX) + ) + endif() + ++if(HAIKU) ++ set(CPACK_SRCS ${CPACK_SRCS} ++ CPack/cmCPackHpkgGenerator.cxx ++ ) ++endif() ++ + if(WIN32) + set(CPACK_SRCS ${CPACK_SRCS} + CPack/WiX/cmCPackWIXGenerator.cxx +diff --git a/Source/elf.h b/Source/elf.h +new file mode 100644 +index 0000000..6b868bb +--- /dev/null ++++ b/Source/elf.h +@@ -0,0 +1,42 @@ ++/* ++ * ++ * /boot/common/include/elf.h ++ * ++ * -I/system/develop/headers/private/system ++ * -I/system/develop/headers/private/system/arch_x86 ++ * ++ * As found on other platforms, for benefit of GHC Haskell compiler, ++ * Donn ++ * */ ++ ++#ifdef __HAIKU__ ++ ++#include ++#include ++ ++typedef struct Elf32_Ehdr Elf32_Ehdr; ++typedef struct Elf32_Shdr Elf32_Shdr; ++typedef struct Elf32_Sym Elf32_Sym; ++typedef struct Elf32_Rel Elf32_Rel; ++typedef struct Elf32_Rela Elf32_Rela; ++ ++#define ELFMAG0 0x7F ++#define ELFMAG1 'E' ++#define ELFMAG2 'L' ++#define ELFMAG3 'F' ++ ++#define ET_NONE 0 ++#define ET_REL 1 ++#define ET_EXEC 2 ++#define ET_DYN 3 ++#define ET_CORE 4 ++ ++#define EM_386 3 ++#define EM_SPARC 2 ++#define EM_PPC 20 ++ ++#else ++ ++#include_next ++ ++#endif +-- +1.8.3.4 + + +From 43ea4f564927235c5131d28d320dd90d09e5e852 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Thu, 17 Oct 2013 19:35:25 +0200 +Subject: CPack: add Haiku hpkg support + + +diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx +index b36c2a2..7d8f8a5 100644 +--- a/Source/CPack/cmCPackGeneratorFactory.cxx ++++ b/Source/CPack/cmCPackGeneratorFactory.cxx +@@ -42,6 +42,10 @@ + # include "WiX/cmCPackWIXGenerator.h" + #endif + ++#ifdef __HAIKU__ ++# include "cmCPackHpkgGenerator.h" ++#endif ++ + #include "cmCPackLog.h" + + #if defined(__BORLANDC__) +@@ -138,6 +142,13 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() + cmCPackRPMGenerator::CreateGenerator); + } + #endif ++#if defined(__HAIKU__) ++ if (cmCPackHpkgGenerator::CanGenerate()) ++ { ++ this->RegisterGenerator("HPKG", "Haiku packages", ++ cmCPackHpkgGenerator::CreateGenerator); ++ } ++#endif + } + + //---------------------------------------------------------------------- +diff --git a/Source/CPack/cmCPackHpkgGenerator.cxx b/Source/CPack/cmCPackHpkgGenerator.cxx +new file mode 100644 +index 0000000..b29e1c0 +--- /dev/null ++++ b/Source/CPack/cmCPackHpkgGenerator.cxx +@@ -0,0 +1,472 @@ ++/*============================================================================ ++ CMake - Cross Platform Makefile Generator ++ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium ++ ++ Distributed under the OSI-approved BSD License (the "License"); ++ see accompanying file Copyright.txt for details. ++ ++ This software is distributed WITHOUT ANY WARRANTY; without even the ++ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ See the License for more information. ++============================================================================*/ ++#include "cmCPackHpkgGenerator.h" ++ ++#include "cmSystemTools.h" ++#include "cmMakefile.h" ++#include "cmGeneratedFileStream.h" ++#include "cmCPackLog.h" ++ ++#include ++#include ++ ++#include // USHRT_MAX ++ ++// NOTE: ++// Haiku .hpkg files are package using a custom compression and archive format. ++// The only way of creating them isusing the package tool provided with Haiku. ++ ++//---------------------------------------------------------------------- ++cmCPackHpkgGenerator::cmCPackHpkgGenerator() ++{ ++} ++ ++//---------------------------------------------------------------------- ++cmCPackHpkgGenerator::~cmCPackHpkgGenerator() ++{ ++} ++ ++//---------------------------------------------------------------------- ++int cmCPackHpkgGenerator::InitializeInternal() ++{ ++ this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/boot/system"); ++ if (cmSystemTools::IsOff(this->GetOption("CPACK_SET_DESTDIR"))) ++ { ++ this->SetOption("CPACK_SET_DESTDIR", "I_ON"); ++ } ++ return this->Superclass::InitializeInternal(); ++} ++ ++//---------------------------------------------------------------------- ++int cmCPackHpkgGenerator::PackageOnePack(std::string initialTopLevel, ++ std::string packageName) ++ { ++ int retval = 1; ++ // Begin the archive for this pack ++ std::string localToplevel(initialTopLevel); ++ std::string packageFileName( ++ cmSystemTools::GetParentDirectory(toplevel.c_str()) ++ ); ++ std::string outputFileName( ++ std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) ++ +"_"+packageName + this->GetOutputExtension() ++ ); ++ ++ localToplevel += "/"+ packageName; ++ /* replace the TEMP DIRECTORY with the component one */ ++ this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); ++ packageFileName += "/"+ outputFileName; ++ /* replace proposed CPACK_OUTPUT_FILE_NAME */ ++ this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); ++ /* replace the TEMPORARY package file name */ ++ this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", ++ packageFileName.c_str()); ++ // Tell CPackHpkg.cmake the name of the component GROUP. ++ this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",packageName.c_str()); ++ // Tell CPackHpkg.cmake the path where the component is. ++ std::string component_path = "/"; ++ component_path += packageName; ++ this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", ++ component_path.c_str()); ++ if (!this->ReadListFile("CPackHpkg.cmake")) ++ { ++ cmCPackLogger(cmCPackLog::LOG_ERROR, ++ "Error while execution CPackHpkg.cmake" << std::endl); ++ retval = 0; ++ return retval; ++ } ++ ++ cmsys::Glob gl; ++ std::string findExpr(this->GetOption("WDIR")); ++ findExpr += "/*"; ++ gl.RecurseOn(); ++ if ( !gl.FindFiles(findExpr) ) ++ { ++ cmCPackLogger(cmCPackLog::LOG_ERROR, ++ "Cannot find any files in the installed directory" << std::endl); ++ return 0; ++ } ++ packageFiles = gl.GetFiles(); ++ ++ int res = createHpkg(); ++ if (res != 1) ++ { ++ retval = 0; ++ } ++ // add the generated package to package file names list ++ packageFileNames.push_back(packageFileName); ++ return retval; ++} ++ ++//---------------------------------------------------------------------- ++int cmCPackHpkgGenerator::PackageComponents(bool ignoreGroup) ++{ ++ int retval = 1; ++ /* Reset package file name list it will be populated during the ++ * component packaging run*/ ++ packageFileNames.clear(); ++ std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); ++ ++ // The default behavior is to have one package by component group ++ // unless CPACK_COMPONENTS_IGNORE_GROUP is specified. ++ if (!ignoreGroup) ++ { ++ std::map::iterator compGIt; ++ for (compGIt=this->ComponentGroups.begin(); ++ compGIt!=this->ComponentGroups.end(); ++compGIt) ++ { ++ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: " ++ << compGIt->first ++ << std::endl); ++ // Begin the archive for this group ++ retval &= PackageOnePack(initialTopLevel,compGIt->first); ++ } ++ // Handle Orphan components (components not belonging to any groups) ++ std::map::iterator compIt; ++ for (compIt=this->Components.begin(); ++ compIt!=this->Components.end(); ++compIt ) ++ { ++ // Does the component belong to a group? ++ if (compIt->second.Group==NULL) ++ { ++ cmCPackLogger(cmCPackLog::LOG_VERBOSE, ++ "Component <" ++ << compIt->second.Name ++ << "> does not belong to any group, package it separately." ++ << std::endl); ++ // Begin the archive for this orphan component ++ retval &= PackageOnePack(initialTopLevel,compIt->first); ++ } ++ } ++ } ++ // CPACK_COMPONENTS_IGNORE_GROUPS is set ++ // We build 1 package per component ++ else ++ { ++ std::map::iterator compIt; ++ for (compIt=this->Components.begin(); ++ compIt!=this->Components.end(); ++compIt ) ++ { ++ retval &= PackageOnePack(initialTopLevel,compIt->first); ++ } ++ } ++ return retval; ++} ++ ++//---------------------------------------------------------------------- ++int cmCPackHpkgGenerator::PackageComponentsAllInOne() ++{ ++ int retval = 1; ++ std::string compInstDirName; ++ /* Reset package file name list it will be populated during the ++ * component packaging run*/ ++ packageFileNames.clear(); ++ std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); ++ ++ compInstDirName = "ALL_COMPONENTS_IN_ONE"; ++ ++ cmCPackLogger(cmCPackLog::LOG_VERBOSE, ++ "Packaging all groups in one package..." ++ "(CPACK_COMPONENTS_ALL_[GROUPS_]IN_ONE_PACKAGE is set)" ++ << std::endl); ++ ++ // The ALL GROUPS in ONE package case ++ std::string localToplevel(initialTopLevel); ++ std::string packageFileName( ++ cmSystemTools::GetParentDirectory(toplevel.c_str()) ++ ); ++ std::string outputFileName( ++ std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) ++ + this->GetOutputExtension() ++ ); ++ // all GROUP in one vs all COMPONENT in one ++ localToplevel += "/"+compInstDirName; ++ ++ /* replace the TEMP DIRECTORY with the component one */ ++ this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); ++ packageFileName += "/"+ outputFileName; ++ /* replace proposed CPACK_OUTPUT_FILE_NAME */ ++ this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); ++ /* replace the TEMPORARY package file name */ ++ this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", ++ packageFileName.c_str()); ++ // Tell CPackHpkg.cmake the path where the component is. ++ std::string component_path = "/"; ++ component_path += compInstDirName; ++ this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", ++ component_path.c_str()); ++ if (!this->ReadListFile("CPackHpkg.cmake")) ++ { ++ cmCPackLogger(cmCPackLog::LOG_ERROR, ++ "Error while execution CPackHpkg.cmake" << std::endl); ++ retval = 0; ++ return retval; ++ } ++ ++ cmsys::Glob gl; ++ std::string findExpr(this->GetOption("WDIR")); ++ findExpr += "/*"; ++ gl.RecurseOn(); ++ if ( !gl.FindFiles(findExpr) ) ++ { ++ cmCPackLogger(cmCPackLog::LOG_ERROR, ++ "Cannot find any files in the installed directory" << std::endl); ++ return 0; ++ } ++ packageFiles = gl.GetFiles(); ++ ++ int res = createHpkg(); ++ if (res != 1) ++ { ++ retval = 0; ++ } ++ // add the generated package to package file names list ++ packageFileNames.push_back(packageFileName); ++ return retval; ++} ++ ++//---------------------------------------------------------------------- ++int cmCPackHpkgGenerator::PackageFiles() ++{ ++ int retval = -1; ++ ++ /* Are we in the component packaging case */ ++ if (WantsComponentInstallation()) { ++ // CASE 1 : COMPONENT ALL-IN-ONE package ++ // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested ++ // then the package file is unique and should be open here. ++ if (componentPackageMethod == ONE_PACKAGE) ++ { ++ return PackageComponentsAllInOne(); ++ } ++ // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) ++ // There will be 1 package for each component group ++ // however one may require to ignore component group and ++ // in this case you'll get 1 package for each component. ++ else ++ { ++ return PackageComponents(componentPackageMethod == ++ ONE_PACKAGE_PER_COMPONENT); ++ } ++ } ++ // CASE 3 : NON COMPONENT package. ++ else ++ { ++ if (!this->ReadListFile("CPackHpkg.cmake")) ++ { ++ cmCPackLogger(cmCPackLog::LOG_ERROR, ++ "Error while execution CPackHpkg.cmake" << std::endl); ++ retval = 0; ++ } ++ else ++ { ++ packageFiles = files; ++ return createHpkg(); ++ } ++ } ++ return retval; ++} ++ ++int cmCPackHpkgGenerator::createHpkg() ++{ ++ const char* cmakeExecutable = this->GetOption("CMAKE_COMMAND"); ++ ++ // control file ++ std::string infofilename; ++ infofilename = this->GetOption("WDIR"); ++ infofilename += "/.PackageInfo"; ++ ++ // haiku policy enforce lower case for package name ++ // mandatory entries: ++ std::string haiku_pkg_name = cmsys::SystemTools::LowerCase( ++ this->GetOption("CPACK_HAIKU_PACKAGE_NAME") ); ++ const char* haiku_pkg_version = ++ this->GetOption("CPACK_HAIKU_PACKAGE_VERSION"); ++ const char* haiku_pkg_revision = ++ this->GetOption("CPACK_HAIKU_PACKAGE_REVISION"); ++ const char* haiku_pkg_arch = ++ this->GetOption("CPACK_HAIKU_PACKAGE_ARCHITECTURE"); ++ const char* maintainer = this->GetOption("CPACK_HAIKU_PACKAGE_PACKAGER"); ++ const char* vendor = this->GetOption("CPACK_HAIKU_PACKAGE_VENDOR"); ++ const char* summary = this->GetOption("CPACK_HAIKU_PACKAGE_DESCRIPTION_SUMMARY"); ++ const char* desc = this->GetOption("CPACK_HAIKU_PACKAGE_DESCRIPTION"); ++ const char* copyrights = this->GetOption("CPACK_HAIKU_PACKAGE_COPYRIGHT"); ++ const char* haiku_pkg_licenses = ++ this->GetOption("CPACK_HAIKU_PACKAGE_LICENSES"); ++ ++ // optional entries ++ const char* haiku_pkg_dep = this->GetOption("CPACK_HAIKU_PACKAGE_DEPENDS"); ++ const char* haiku_pkg_url = ++ this->GetOption("CPACK_HAIKU_PACKAGE_HOMEPAGE"); ++ const char* haiku_pkg_enhances = ++ this->GetOption("CPACK_HAIKU_PACKAGE_ENHANCES"); ++ const char* haiku_pkg_conflicts = ++ this->GetOption("CPACK_HAIKU_PACKAGE_CONFLICTS"); ++ const char* haiku_pkg_provides = ++ this->GetOption("CPACK_HAIKU_PACKAGE_PROVIDES"); ++ const char* haiku_pkg_replaces = ++ this->GetOption("CPACK_HAIKU_PACKAGE_REPLACES"); ++ ++ { // the scope is needed for cmGeneratedFileStream ++ cmGeneratedFileStream out(infofilename.c_str()); ++ out << "name " << haiku_pkg_name << "\n"; ++ out << "version " << haiku_pkg_version << "-" << haiku_pkg_revision << "\n"; ++ out << "architecture " << haiku_pkg_arch << "\n"; ++ if(haiku_pkg_dep && *haiku_pkg_dep) ++ { ++ out << "requires " << haiku_pkg_dep << "\n"; ++ } ++ if(haiku_pkg_url && *haiku_pkg_url) ++ { ++ out << "urls " << haiku_pkg_url << "\n"; ++ } ++ if (haiku_pkg_enhances && *haiku_pkg_enhances) ++ { ++ out << "freshens " << haiku_pkg_enhances << "\n"; ++ } ++ if (haiku_pkg_conflicts && *haiku_pkg_conflicts) ++ { ++ out << "conflicts " << haiku_pkg_conflicts << "\n"; ++ } ++ if (haiku_pkg_replaces && *haiku_pkg_replaces) ++ { ++ out << "replaces " << haiku_pkg_replaces << "\n"; ++ } ++ out << "provides {" << haiku_pkg_provides << "}\n"; ++ out << "copyrights {\"" << copyrights << "\"}\n"; ++ ++ out << "licenses {"; ++ std::vector licensesList; ++ cmSystemTools::ExpandListArgument(haiku_pkg_licenses, licensesList); ++ for(std::vector::iterator i = ++ licensesList.begin(); i != licensesList.end(); ++i) ++ { ++ out << "\"" << *i << "\"\n"; ++ } ++ ++ out << "}\n"; ++ out << "packager " << maintainer << "\n"; ++ out << "vendor " << vendor << "\n"; ++ out << "summary \"" << summary << "\"\n"; ++ out << "description \"" << desc << "\"\n"; ++ out << std::endl; ++ } ++ ++ std::string cmd; ++ if (NULL != this->GetOption("CPACK_HAIKU_FAKEROOT_EXECUTABLE")) { ++ cmd += this->GetOption("CPACK_HAIKU_FAKEROOT_EXECUTABLE"); ++ } ++ cmd += "package create "; ++ cmd += this->GetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME"); ++ ++ std::string output; ++ int retval = -1; ++ int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, ++ &retval, this->GetOption("WDIR"), this->GeneratorVerbose, 0); ++ ++ if ( !res || retval ) ++ { ++ std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); ++ tmpFile += "/Hpkg.log"; ++ cmGeneratedFileStream ofs(tmpFile.c_str()); ++ ofs << "# Run command: " << cmd.c_str() << std::endl ++ << "# Working directory: " << toplevel << std::endl ++ << "# Output:" << std::endl ++ << output.c_str() << std::endl; ++ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running package command: " ++ << cmd.c_str() << std::endl ++ << "Please check " << tmpFile.c_str() << " for errors" << std::endl); ++ return 0; ++ } ++ ++ const char* infoExtra = ++ this->GetOption("CPACK_HAIKU_PACKAGE_INFO_EXTRA"); ++ if( infoExtra ) ++ { ++ std::vector controlExtraList; ++ cmSystemTools::ExpandListArgument(infoExtra, controlExtraList); ++ for(std::vector::iterator i = ++ controlExtraList.begin(); i != controlExtraList.end(); ++i) ++ { ++ std::string filenamename = ++ cmsys::SystemTools::GetFilenameName(i->c_str()); ++ std::string localcopy = this->GetOption("WDIR"); ++ localcopy += "/"; ++ localcopy += filenamename; ++ // if we can copy the file, it means it does exist, let's add it: ++ if( cmsys::SystemTools::CopyFileIfDifferent( ++ i->c_str(), localcopy.c_str()) ) ++ { ++ // haiku is picky and need relative to ./ path in the tar.gz ++ cmd += " ./"; ++ cmd += filenamename; ++ } ++ } ++ } ++ res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, ++ &retval, this->GetOption("WDIR"), this->GeneratorVerbose, 0); ++ ++ if ( !res || retval ) ++ { ++ std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); ++ tmpFile += "/Hpkg.log"; ++ cmGeneratedFileStream ofs(tmpFile.c_str()); ++ ofs << "# Run command: " << cmd.c_str() << std::endl ++ << "# Working directory: " << toplevel << std::endl ++ << "# Output:" << std::endl ++ << output.c_str() << std::endl; ++ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: " ++ << cmd.c_str() << std::endl ++ << "Please check " << tmpFile.c_str() << " for errors" << std::endl); ++ return 0; ++ } ++ ++ return 1; ++} ++ ++bool cmCPackHpkgGenerator::SupportsComponentInstallation() const ++ { ++ if (IsOn("CPACK_HAIKU_COMPONENT_INSTALL")) ++ { ++ return true; ++ } ++ else ++ { ++ return false; ++ } ++ } ++ ++std::string cmCPackHpkgGenerator::GetComponentInstallDirNameSuffix( ++ const std::string& componentName) ++ { ++ if (componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { ++ return componentName; ++ } ++ ++ if (componentPackageMethod == ONE_PACKAGE) { ++ return std::string("ALL_COMPONENTS_IN_ONE"); ++ } ++ // We have to find the name of the COMPONENT GROUP ++ // the current COMPONENT belongs to. ++ std::string groupVar = "CPACK_COMPONENT_" + ++ cmSystemTools::UpperCase(componentName) + "_GROUP"; ++ if (NULL != GetOption(groupVar.c_str())) ++ { ++ return std::string(GetOption(groupVar.c_str())); ++ } ++ else ++ { ++ return componentName; ++ } ++ } ++ ++ +diff --git a/Source/CPack/cmCPackHpkgGenerator.h b/Source/CPack/cmCPackHpkgGenerator.h +new file mode 100644 +index 0000000..36e6e78 +--- /dev/null ++++ b/Source/CPack/cmCPackHpkgGenerator.h +@@ -0,0 +1,73 @@ ++/*============================================================================ ++ CMake - Cross Platform Makefile Generator ++ Copyright 2000-2013 Kitware, Inc. ++ ++ Distributed under the OSI-approved BSD License (the "License"); ++ see accompanying file Copyright.txt for details. ++ ++ This software is distributed WITHOUT ANY WARRANTY; without even the ++ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ See the License for more information. ++============================================================================*/ ++ ++#ifndef cmCPackHpkgGenerator_h ++#define cmCPackHpkgGenerator_h ++ ++ ++#include "cmCPackGenerator.h" ++ ++/** \class cmCPackHpkgGenerator ++ * \brief A generator for Haiku packages ++ * ++ */ ++class cmCPackHpkgGenerator : public cmCPackGenerator ++{ ++public: ++ cmCPackTypeMacro(cmCPackHpkgGenerator, cmCPackGenerator); ++ ++ /** ++ * Construct generator ++ */ ++ cmCPackHpkgGenerator(); ++ virtual ~cmCPackHpkgGenerator(); ++ ++ static bool CanGenerate() ++ { ++#ifdef __HAIKU__ ++ return true; ++#else ++ // Sorry! Need the "package" tool from Haiku! ++ return false; ++#endif ++ } ++ ++protected: ++ virtual int InitializeInternal(); ++ /** ++ * This method factors out the work done in component packaging case. ++ */ ++ int PackageOnePack(std::string initialToplevel, std::string packageName); ++ /** ++ * The method used to package files when component ++ * install is used. This will create one ++ * archive for each component group. ++ */ ++ int PackageComponents(bool ignoreGroup); ++ /** ++ * Special case of component install where all ++ * components will be put in a single installer. ++ */ ++ int PackageComponentsAllInOne(); ++ virtual int PackageFiles(); ++ virtual const char* GetOutputExtension() { return ".hpkg"; } ++ virtual bool SupportsComponentInstallation() const; ++ virtual std::string GetComponentInstallDirNameSuffix( ++ const std::string& componentName); ++ ++private: ++ int createHpkg(); ++ std::vector packageFiles; ++ ++}; ++ ++#endif +-- +1.8.3.4 +