diff options
author | Tomas Chvatal <scarabeus@gentoo.org> | 2008-12-02 23:25:37 +0000 |
---|---|---|
committer | Tomas Chvatal <scarabeus@gentoo.org> | 2008-12-02 23:25:37 +0000 |
commit | 33c268f230eaf90d6d626282f6250569af000adb (patch) | |
tree | 744ddac29c72acf96162ec3a7f901267cf0e3a57 /dev-util/cmake | |
parent | Version bump, automatically refresh remote directory listing if queue finishe... (diff) | |
download | historical-33c268f230eaf90d6d626282f6250569af000adb.tar.gz historical-33c268f230eaf90d6d626282f6250569af000adb.tar.bz2 historical-33c268f230eaf90d6d626282f6250569af000adb.zip |
Dupe old. Update current to eapi2. Fixes bug #226153.
Package-Manager: portage-2.2_rc16/cvs/Linux 2.6.27-gentoo x86_64
Diffstat (limited to 'dev-util/cmake')
-rw-r--r-- | dev-util/cmake/ChangeLog | 7 | ||||
-rw-r--r-- | dev-util/cmake/Manifest | 8 | ||||
-rw-r--r-- | dev-util/cmake/cmake-2.6.1.ebuild | 131 | ||||
-rw-r--r-- | dev-util/cmake/cmake-2.6.2.ebuild | 26 | ||||
-rw-r--r-- | dev-util/cmake/files/cmake-2.6.1-gc-sections.patch | 172 | ||||
-rw-r--r-- | dev-util/cmake/files/cmake-2.6.1-rpath.patch | 531 |
6 files changed, 15 insertions, 860 deletions
diff --git a/dev-util/cmake/ChangeLog b/dev-util/cmake/ChangeLog index ebbdd93907dc..d4d8be1a0dec 100644 --- a/dev-util/cmake/ChangeLog +++ b/dev-util/cmake/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for dev-util/cmake # Copyright 2000-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-util/cmake/ChangeLog,v 1.75 2008/09/27 16:15:44 cryos Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-util/cmake/ChangeLog,v 1.76 2008/12/02 23:25:37 scarabeus Exp $ + + 02 Dec 2008; Tomas Chvatal <scarabeus@gentoo.org> + -files/cmake-2.6.1-gc-sections.patch, -files/cmake-2.6.1-rpath.patch, + -cmake-2.6.1.ebuild, cmake-2.6.2.ebuild: + Dupe old. Update current to eapi2. Fixes bug #226153. *cmake-2.6.2 (27 Sep 2008) diff --git a/dev-util/cmake/Manifest b/dev-util/cmake/Manifest index 525a83298983..75c8751ef448 100644 --- a/dev-util/cmake/Manifest +++ b/dev-util/cmake/Manifest @@ -2,19 +2,15 @@ AUX 50cmake-gentoo.el 244 RMD160 effb4416a5170ed7c99ea74084f2598e2482fdf0 SHA1 c AUX FindSWIG.cmake 2263 RMD160 c56589a1b2401b3b55a5d3f5336d8ad7d797b4c6 SHA1 c3687448a47ba49d9d03fea5ed0ba93cb85b60ae SHA256 5be6bdbfaf93f7d69845544b697d120732341ed2d8af043cdd43f5a892d06de0 AUX cmake-2.0.6-rpath-fix.patch 526 RMD160 9039e42ce4def8ae7ce38946cb55b95b4502a1e9 SHA1 8e181634b1663a27139682309fb4180a0dbaa82d SHA256 18c58ecf9bdddce15764ab3481aba570e3378f8d8b1c5306a050b2c33323a1bc AUX cmake-2.4.7-findkde4.patch 1884 RMD160 918d56910e18ffec856f1cc67d0b67117736ae09 SHA1 6314d9dea24bfbcd262517aceead4b273e116c54 SHA256 bd22024e222d7bd0d99fa932bf193803acb956887bb6b41ecf2eca96ba0a5e3b -AUX cmake-2.6.1-gc-sections.patch 3981 RMD160 e5d0ec0e881ba57af5c95aad05b40d062b952fc5 SHA1 75fff881209344ccdf55acb1bd9830bb8f0a29c1 SHA256 306a7e868a58456fbb33e27f7f33053b5e3a2ec868c937112baee8310eb4a790 -AUX cmake-2.6.1-rpath.patch 15526 RMD160 db2ddd31abc8c390a62498d25a615086dea87aa6 SHA1 9967fc8656b9f7aa054069400d51bc882e386990 SHA256 500cb1bb6054c40dc9735f40ab6da02075bf82b7b94e0a325a11c7aa9a720290 AUX cmake-FindPythonLibs.patch 530 RMD160 3e012fbf78d649d6c8111d72d384da3b1b838268 SHA1 0576f44f61465b8403471f0648653226f843d3bd SHA256 1e7bff2a1e999ac877ffeac1414e54e1685c5ef303d698db50d81201029204ab AUX cmake.vim 217 RMD160 3ac23077646d31e9c29ff32ae2eba20b63c07809 SHA1 527b989aec74eb260c16f93baf189c2e6794b3d8 SHA256 7366c1d45bdcc93efb1954216a5427a5f9df7e98a1f706c357576d7835aaebc5 DIST cmake-2.4.6.tar.gz 2604547 RMD160 61af13faecd10e85a0fee3252630b30b8781987a SHA1 5290aaf949413ee7f77275ba68e73cec1546364b SHA256 afb82bcf732d317f254b51ffdcd95e0a3b3c101c02f3751b12ce25fe46c0c304 DIST cmake-2.4.7.tar.gz 2600960 RMD160 7fed176c42f39c25e1d4c761436aa4d5a8a64e3a SHA1 72308fdd131d5a5ad1c617769c16a417ebec0004 SHA256 2fd5feb294b933ae3a0071b8c7a396797cf79dfe6b0ffeff8788e07ff4107d56 DIST cmake-2.4.8.tar.gz 2608800 RMD160 3f75f77a0eca4c1e1e4506b00c56ca441f78c853 SHA1 5d253b128274cc9517bce92fc25798d55baa253b SHA256 f20607d4f33376ea648307681630574662d0c3f59d88a7a02ad547b6320631f1 -DIST cmake-2.6.1.tar.gz 3518689 RMD160 534d2d6e43724fd316d50f5fb9d189ea060a8d74 SHA1 a0bcdffbbd03b877f8e13c250ed6fa5d290e16d0 SHA256 2e0040fd2ecd4fbe29db0429eeeecd078f2f8b2bf0e5fafced209c32bea20d80 DIST cmake-2.6.2.tar.gz 3543548 RMD160 df7ed9bba605bf31494aa1b835dee264b5fcb6bd SHA1 48d33afaf23d40f2ea9aa2f5018c7213983222c2 SHA256 b3f5a9dfa97fb82cb1b7d78a62d949f93c8d4317af36674f337d27066fa6b7e9 EBUILD cmake-2.4.6-r1.ebuild 1933 RMD160 db78c10337212e1509cfbde355f9a5df954e347d SHA1 82048b8a1f483bafb1cb7fb3817c1ac56d804c2d SHA256 2504feaecd4ceae8c757da875d8a5d191be5783c0b9498dcc9f94c29ddaa76fb EBUILD cmake-2.4.7-r1.ebuild 2103 RMD160 c508a57af1782d997537316a155277d9dba8f54a SHA1 68d0d5aa0ef76b492df5795f2539a9f0973abcca SHA256 f09541251a3d019e9813eaaa9817f24e778905e9d4591d5f6bf7a0fb3763f805 EBUILD cmake-2.4.8.ebuild 2786 RMD160 3a3fe9e0c38d2ab111e6b33e406786a8036b947e SHA1 b77551366524b13e51776251bf5e0411f244f9cb SHA256 3e2dcfa3c8ec27729d86596743ef1da35a990975fda769b38f9f50d819bfcbe7 -EBUILD cmake-2.6.1.ebuild 3395 RMD160 58d3e4040ef265f7fed48c4a4abeb1a508b69c5b SHA1 073564f32ecd98e6c4bda61a32eeaac9a35de1c1 SHA256 74e50ec49f95e8c77ca07daadc35aa3475e005ecad2deb6a73264aa9be965cc5 -EBUILD cmake-2.6.2.ebuild 3174 RMD160 a800e97ef126677f0e53ffa7057fc0ecd59bfb6d SHA1 cf6020cb03559f22581ecb6b5b366df76daf37c2 SHA256 594142326e39cf5e72f353d57a2eb2434a628e0231ca228b130b0096d8bd84bc -MISC ChangeLog 11760 RMD160 ec15644d4f5d7d9cc8ef91a69183e4eefcc5066e SHA1 500905e4b8bd48b2c30a2612b7325c13a2e8676b SHA256 9407044c924628abe352826c13f280a07afee534d94555efebbe4757c60ba99f +EBUILD cmake-2.6.2.ebuild 2790 RMD160 544b72eb61e9c11045ebd6eecc54fff27753d8a2 SHA1 1a22ffd7b1fe5163b40e411b12ba03cc77a7e14b SHA256 68a8cca8707d1b4b7497f6e1f0c5e7138cc92a8ba0bdccffe5bc6ff1b74b643a +MISC ChangeLog 11988 RMD160 a7d3f049f9f3c27606bc4fb8a81beabf4d6710a2 SHA1 57c3f6941818792ac96f466f4936d488401df76e SHA256 50c68122a526c250b58b5c3988234289bfdc9288cb3a57ee695c48d491a9c8af MISC metadata.xml 157 RMD160 09fb7b798f3f68127626e97c69e5215a0513ecbb SHA1 d5ffebb2f4248fc8f65ab21c3af6e4f5dbf8bf6e SHA256 01f6fa4357ce08e8b0f7900a51fa78c7f060fefc7c7da98acaec1e283dd59892 diff --git a/dev-util/cmake/cmake-2.6.1.ebuild b/dev-util/cmake/cmake-2.6.1.ebuild deleted file mode 100644 index 411301ccba15..000000000000 --- a/dev-util/cmake/cmake-2.6.1.ebuild +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright 1999-2008 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-util/cmake/cmake-2.6.1.ebuild,v 1.1 2008/08/27 21:19:10 tgurr Exp $ - -EAPI="1" - -inherit elisp-common toolchain-funcs eutils versionator flag-o-matic - -MY_PV="${PV/rc/RC-}" -MY_P="${PN}-$(replace_version_separator 3 - ${MY_PV})" - -DESCRIPTION="Cross platform Make" -HOMEPAGE="http://www.cmake.org/" -SRC_URI="http://www.cmake.org/files/v$(get_version_component_range 1-2)/${MY_P}.tar.gz" - -LICENSE="CMake" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" -IUSE="emacs qt4 vim-syntax" - -DEPEND=">=net-misc/curl-7.16.4 - >=dev-libs/expat-2.0.1 - >=dev-libs/libxml2-2.6.28 - >=dev-libs/xmlrpc-c-1.06.09 - emacs? ( virtual/emacs ) - qt4? ( || ( ( x11-libs/qt-core:4 - x11-libs/qt-gui:4 ) - >=x11-libs/qt-4.3:4 ) ) - vim-syntax? ( || ( - app-editors/vim - app-editors/gvim ) )" -RDEPEND="${DEPEND}" - -SITEFILE="50${PN}-gentoo.el" -VIMFILE="${PN}.vim" - -S="${WORKDIR}/${MY_P}" - -pkg_setup() { - if ! built_with_use -o dev-libs/xmlrpc-c curl libwww; then - echo - eerror "${PN} requires dev-libs/xmlrpc-c to be built with either the 'libwww' or" - eerror "the 'curl' USE flag or both enabled." - eerror "Please re-emerge dev-libs/xmlrpc-c with USE=\"libwww\" or USE=\"curl\"." - echo - die "Please re-emerge dev-libs/xmlrpc-c with USE=\"libwww\" or USE=\"curl\"." - fi -} - -src_unpack() { - unpack ${A} - cd "${S}" - - # Upstream fix, compatibility with -Wl,--gc-sections, bug #235731 - epatch "${FILESDIR}/${PN}-2.6.1-gc-sections.patch" - - # Upstream fix, rpath handling security, bug #224901 - epatch "${FILESDIR}/${PN}-2.6.1-rpath.patch" - - # Link against the shared Python library rather than the static one - epatch "${FILESDIR}/${PN}-FindPythonLibs.patch" -} - -src_compile() { - if [[ "$(gcc-major-version)" -eq "3" ]] ; then - append-flags "-fno-stack-protector" - fi - - tc-export CC CXX LD - - local qt_arg - if use qt4; then - qt_arg="--qt-gui" - else - qt_arg="--no-qt-gui" - fi - - local par_arg - echo $MAKEOPTS | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' > /dev/null - if [ $? -eq 0 ]; then - par_arg=$(echo $MAKEOPTS | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' | egrep -o '[[:digit:]]+') - par_arg="--parallel=${par_arg}" - else - par_arg="--parallel=1" - fi - - ./bootstrap \ - --system-libs \ - --prefix=/usr \ - --docdir=/share/doc/${PF} \ - --datadir=/share/${PN} \ - --mandir=/share/man \ - "$qt_arg" \ - "$par_arg" || die "./bootstrap failed" - - emake || die "emake failed." - if use emacs; then - elisp-compile Docs/cmake-mode.el || die "elisp compile failed" - fi -} - -src_test() { - emake test || \ - einfo "note test failure on qtwrapping was expected - nature of portage rather than a true failure" -} - -src_install() { - emake install DESTDIR="${D}" || die "install failed" - if use emacs; then - elisp-install ${PN} Docs/cmake-mode.el Docs/cmake-mode.elc || die "elisp-install failed" - elisp-site-file-install "${FILESDIR}/${SITEFILE}" - fi - if use vim-syntax; then - insinto /usr/share/vim/vimfiles/syntax - doins "${S}"/Docs/cmake-syntax.vim - - insinto /usr/share/vim/vimfiles/indent - doins "${S}"/Docs/cmake-indent.vim - - insinto /usr/share/vim/vimfiles/ftdetect - doins "${FILESDIR}/${VIMFILE}" - fi -} - -pkg_postinst() { - use emacs && elisp-site-regen -} - -pkg_postrm() { - use emacs && elisp-site-regen -} diff --git a/dev-util/cmake/cmake-2.6.2.ebuild b/dev-util/cmake/cmake-2.6.2.ebuild index 896798d7887e..e5eec3617f16 100644 --- a/dev-util/cmake/cmake-2.6.2.ebuild +++ b/dev-util/cmake/cmake-2.6.2.ebuild @@ -1,8 +1,8 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-util/cmake/cmake-2.6.2.ebuild,v 1.1 2008/09/27 16:15:44 cryos Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-util/cmake/cmake-2.6.2.ebuild,v 1.2 2008/12/02 23:25:37 scarabeus Exp $ -EAPI="1" +EAPI="2" inherit elisp-common toolchain-funcs eutils versionator flag-o-matic @@ -21,7 +21,7 @@ IUSE="emacs qt4 vim-syntax" DEPEND=">=net-misc/curl-7.16.4 >=dev-libs/expat-2.0.1 >=dev-libs/libxml2-2.6.28 - >=dev-libs/xmlrpc-c-1.06.09 + >=dev-libs/xmlrpc-c-1.06.09[curl] emacs? ( virtual/emacs ) qt4? ( || ( ( x11-libs/qt-core:4 x11-libs/qt-gui:4 ) @@ -36,26 +36,12 @@ VIMFILE="${PN}.vim" S="${WORKDIR}/${MY_P}" -pkg_setup() { - if ! built_with_use -o dev-libs/xmlrpc-c curl libwww; then - echo - eerror "${PN} requires dev-libs/xmlrpc-c to be built with either the 'libwww' or" - eerror "the 'curl' USE flag or both enabled." - eerror "Please re-emerge dev-libs/xmlrpc-c with USE=\"libwww\" or USE=\"curl\"." - echo - die "Please re-emerge dev-libs/xmlrpc-c with USE=\"libwww\" or USE=\"curl\"." - fi -} - -src_unpack() { - unpack ${A} - cd "${S}" - +src_prepare() { # Link against the shared Python library rather than the static one epatch "${FILESDIR}/${PN}-FindPythonLibs.patch" } -src_compile() { +src_configure() { if [[ "$(gcc-major-version)" -eq "3" ]] ; then append-flags "-fno-stack-protector" fi @@ -77,7 +63,9 @@ src_compile() { else par_arg="--parallel=1" fi +} +src_compile() { ./bootstrap \ --system-libs \ --prefix=/usr \ diff --git a/dev-util/cmake/files/cmake-2.6.1-gc-sections.patch b/dev-util/cmake/files/cmake-2.6.1-gc-sections.patch deleted file mode 100644 index 325c5a9f7a80..000000000000 --- a/dev-util/cmake/files/cmake-2.6.1-gc-sections.patch +++ /dev/null @@ -1,172 +0,0 @@ -Fix compatibility with -Wl,--gc-sections. - -http://www.cmake.org/pipermail/cmake/2008-August/023240.html -http://www.cmake.org/pipermail/cmake-commits/2008-August/004477.html - ---- Modules/CheckTypeSizeC.c.in -+++ Modules/CheckTypeSizeC.c.in -@@ -29,15 +29,16 @@ - ('0' + (SIZE % 10)), - ']','\0'}; - -- - #ifdef __CLASSIC_C__ --int main(){ -- int ac; -- char*av[]; -+int main(argc, argv) int argc; char *argv[]; - #else --int main(int ac, char*av[]){ -+int main(int argc, char *argv[]) - #endif -- return (&info_sizeof[0] != &info_sizeof[0]); -+{ -+ int require = 0; -+ require += info_sizeof[argc]; -+ (void)argv; -+ return require; - } - - #else /* CHECK_TYPE_SIZE_TYPE */ ---- Modules/CMakeCCompilerABI.c -+++ Modules/CMakeCCompilerABI.c -@@ -12,17 +12,17 @@ - - /*--------------------------------------------------------------------------*/ - --/* Make sure the information strings are referenced. */ --#define REQUIRE(x) (&x[0] != &require) -- --int main() -+#ifdef __CLASSIC_C__ -+int main(argc, argv) int argc; char *argv[]; -+#else -+int main(int argc, char *argv[]) -+#endif - { -- const char require = 0; -- return -- ( -- REQUIRE(info_sizeof_dptr) -+ int require = 0; -+ require += info_sizeof_dptr[argc]; - #if defined(ABI_ID) -- && REQUIRE(info_abi) -+ require += info_abi[argc]; - #endif -- ); -+ (void)argv; -+ return require; - } ---- Modules/CMakeCCompilerId.c.in -+++ Modules/CMakeCCompilerId.c.in -@@ -2,15 +2,9 @@ - # error "A C++ compiler has been selected for C." - #endif - --/* Provide main() so the program can link. */ - #if defined(__18CXX) - # define ID_VOID_MAIN - #endif --#ifdef ID_VOID_MAIN --void main() {} --#else --int main() { return 0; } --#endif - - #if defined(__INTEL_COMPILER) || defined(__ICC) - # define COMPILER_ID "Intel" -@@ -82,3 +76,18 @@ - char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; - - @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@ -+ -+/*--------------------------------------------------------------------------*/ -+ -+#ifdef ID_VOID_MAIN -+void main() {} -+#else -+int main(int argc, char* argv[]) -+{ -+ int require = 0; -+ require += info_compiler[argc]; -+ require += info_platform[argc]; -+ (void)argv; -+ return require; -+} -+#endif ---- Modules/CMakeCXXCompilerABI.cpp -+++ Modules/CMakeCXXCompilerABI.cpp -@@ -8,17 +8,13 @@ - - /*--------------------------------------------------------------------------*/ - --/* Make sure the information strings are referenced. */ --#define REQUIRE(x) (&x[0] != &require) -- --int main() -+int main(int argc, char* argv[]) - { -- const char require = 0; -- return -- ( -- REQUIRE(info_sizeof_dptr) -+ int require = 0; -+ require += info_sizeof_dptr[argc]; - #if defined(ABI_ID) -- && REQUIRE(info_abi) -+ require += info_abi[argc]; - #endif -- ); -+ (void)argv; -+ return require; - } ---- Modules/CMakeCXXCompilerId.cpp.in -+++ Modules/CMakeCXXCompilerId.cpp.in -@@ -5,9 +5,6 @@ - # error "A C compiler has been selected for C++." - #endif - --/* Provide main() so the program can link. */ --int main() { return 0; } -- - #if defined(__COMO__) - # define COMPILER_ID "Comeau" - -@@ -70,3 +67,14 @@ - char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; - - @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@ -+ -+/*--------------------------------------------------------------------------*/ -+ -+int main(int argc, char* argv[]) -+{ -+ int require = 0; -+ require += info_compiler[argc]; -+ require += info_platform[argc]; -+ (void)argv; -+ return require; -+} ---- Modules/TestEndianess.c.in -+++ Modules/TestEndianess.c.in -@@ -10,11 +10,14 @@ - const cmakeint16 info_big[] = {0x5448, 0x4953, 0x2049, 0x5320, 0x4249, 0x4720, 0x454e, 0x4449, 0x414e, 0x2e2e, 0x0000}; - - #ifdef __CLASSIC_C__ --int main(){ -- int ac; -- char*av[]; -+int main(argc, argv) int argc; char *argv[]; - #else --int main(int ac, char*av[]){ -+int main(int argc, char *argv[]) - #endif -- return (&info_little[0] != &info_big[0]); -+{ -+ int require = 0; -+ require += info_little[argc]; -+ require += info_big[argc]; -+ (void)argv; -+ return require; - } diff --git a/dev-util/cmake/files/cmake-2.6.1-rpath.patch b/dev-util/cmake/files/cmake-2.6.1-rpath.patch deleted file mode 100644 index d59289ec4e08..000000000000 --- a/dev-util/cmake/files/cmake-2.6.1-rpath.patch +++ /dev/null @@ -1,531 +0,0 @@ -diff --git cmake-2.6.1-orig/Source/cmFileCommand.cxx cmake-2.6.1/Source/cmFileCommand.cxx -index 6ac6bcc..e8e64a4 100644 ---- cmake-2.6.1-orig/Source/cmFileCommand.cxx -+++ cmake-2.6.1/Source/cmFileCommand.cxx -@@ -1486,7 +1486,8 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args) - cmSystemToolsFileTime* ft = cmSystemTools::FileTimeNew(); - bool have_ft = cmSystemTools::FileTimeGet(file, ft); - std::string emsg; -- if(!cmSystemTools::RemoveRPath(file, &emsg)) -+ bool removed; -+ if(!cmSystemTools::RemoveRPath(file, &emsg, &removed)) - { - cmOStringStream e; - e << "RPATH_REMOVE could not remove RPATH from file:\n" -@@ -1495,9 +1496,19 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args) - this->SetError(e.str().c_str()); - success = false; - } -- if(success && have_ft) -+ if(success) - { -- cmSystemTools::FileTimeSet(file, ft); -+ if(removed) -+ { -+ std::string message = "Removed runtime path from \""; -+ message += file; -+ message += "\""; -+ this->Makefile->DisplayStatus(message.c_str(), -1); -+ } -+ if(have_ft) -+ { -+ cmSystemTools::FileTimeSet(file, ft); -+ } - } - cmSystemTools::FileTimeDelete(ft); - return success; -diff --git cmake-2.6.1-orig/Source/cmSystemTools.cxx cmake-2.6.1/Source/cmSystemTools.cxx -index 4e1f945..f333a4c 100644 ---- cmake-2.6.1-orig/Source/cmSystemTools.cxx -+++ cmake-2.6.1/Source/cmSystemTools.cxx -@@ -26,6 +26,7 @@ - #if defined(CMAKE_BUILD_WITH_CMAKE) - # include <cmsys/Terminal.h> - #endif -+#include <cmsys/stl/algorithm> - - #if defined(_WIN32) - # include <windows.h> -@@ -2328,6 +2329,16 @@ std::string::size_type cmSystemToolsFindRPath(std::string const& have, - } - #endif - -+#if defined(CMAKE_USE_ELF_PARSER) -+struct cmSystemToolsRPathInfo -+{ -+ unsigned long Position; -+ unsigned long Size; -+ std::string Name; -+ std::string Value; -+}; -+#endif -+ - //---------------------------------------------------------------------------- - bool cmSystemTools::ChangeRPath(std::string const& file, - std::string const& oldRPath, -@@ -2340,37 +2351,71 @@ bool cmSystemTools::ChangeRPath(std::string const& file, - { - *changed = false; - } -- unsigned long rpathPosition = 0; -- unsigned long rpathSize = 0; -- std::string rpathPrefix; -- std::string rpathSuffix; -+ int rp_count = 0; -+ cmSystemToolsRPathInfo rp[2]; - { - // Parse the ELF binary. - cmELF elf(file.c_str()); - -- // Get the RPATH or RUNPATH entry from it. -- cmELF::StringEntry const* se = elf.GetRPath(); -- if(!se) -+ // Get the RPATH and RUNPATH entries from it. -+ int se_count = 0; -+ cmELF::StringEntry const* se[2] = {0, 0}; -+ const char* se_name[2] = {0, 0}; -+ if(cmELF::StringEntry const* se_rpath = elf.GetRPath()) - { -- se = elf.GetRunPath(); -+ se[se_count] = se_rpath; -+ se_name[se_count] = "RPATH"; -+ ++se_count; -+ } -+ if(cmELF::StringEntry const* se_runpath = elf.GetRunPath()) -+ { -+ se[se_count] = se_runpath; -+ se_name[se_count] = "RUNPATH"; -+ ++se_count; -+ } -+ if(se_count == 0) -+ { -+ if(newRPath.empty()) -+ { -+ // The new rpath is empty and there is no rpath anyway so it is -+ // okay. -+ return true; -+ } -+ else -+ { -+ if(emsg) -+ { -+ *emsg = "No valid ELF RPATH or RUNPATH entry exists in the file; "; -+ *emsg += elf.GetErrorMessage(); -+ } -+ return false; -+ } - } - -- if(se) -+ for(int i=0; i < se_count; ++i) - { -+ // If both RPATH and RUNPATH refer to the same string literal it -+ // needs to be changed only once. -+ if(rp_count && rp[0].Position == se[i]->Position) -+ { -+ continue; -+ } -+ - // Make sure the current rpath contains the old rpath. -- std::string::size_type pos = cmSystemToolsFindRPath(se->Value, oldRPath); -+ std::string::size_type pos = -+ cmSystemToolsFindRPath(se[i]->Value, oldRPath); - if(pos == std::string::npos) - { - // If it contains the new rpath instead then it is okay. -- if(cmSystemToolsFindRPath(se->Value, newRPath) != std::string::npos) -+ if(cmSystemToolsFindRPath(se[i]->Value, newRPath) != std::string::npos) - { -- return true; -+ continue; - } - if(emsg) - { - cmOStringStream e; -- e << "The current RPATH is:\n" -- << " " << se->Value << "\n" -+ e << "The current " << se_name[i] << " is:\n" -+ << " " << se[i]->Value << "\n" - << "which does not contain:\n" - << " " << oldRPath << "\n" - << "as was expected."; -@@ -2379,47 +2424,43 @@ bool cmSystemTools::ChangeRPath(std::string const& file, - return false; - } - -- // Store information about the entry. -- rpathPosition = se->Position; -- rpathSize = se->Size; -+ // Store information about the entry in the file. -+ rp[rp_count].Position = se[i]->Position; -+ rp[rp_count].Size = se[i]->Size; -+ rp[rp_count].Name = se_name[i]; - -- // Store the part of the path we must preserve. -- rpathPrefix = se->Value.substr(0, pos); -- rpathSuffix = se->Value.substr(pos+oldRPath.length(), oldRPath.npos); -- } -- else if(newRPath.empty()) -- { -- // The new rpath is empty and there is no rpath anyway so it is -- // okay. -- return true; -- } -- else -- { -- if(emsg) -+ // Construct the new value which preserves the part of the path -+ // not being changed. -+ rp[rp_count].Value = se[i]->Value.substr(0, pos); -+ rp[rp_count].Value += newRPath; -+ rp[rp_count].Value += se[i]->Value.substr(pos+oldRPath.length(), -+ oldRPath.npos); -+ -+ // Make sure there is enough room to store the new rpath and at -+ // least one null terminator. -+ if(rp[rp_count].Size < rp[rp_count].Value.length()+1) - { -- *emsg = "No valid ELF RPATH entry exists in the file; "; -- *emsg += elf.GetErrorMessage(); -+ if(emsg) -+ { -+ *emsg = "The replacement path is too long for the "; -+ *emsg += se_name[i]; -+ *emsg += " entry."; -+ } -+ return false; - } -- return false; -+ -+ // This entry is ready for update. -+ ++rp_count; - } - } -- // Compute the full new rpath. -- std::string rpath = rpathPrefix; -- rpath += newRPath; -- rpath += rpathSuffix; - -- // Make sure there is enough room to store the new rpath and at -- // least one null terminator. -- if(rpathSize < rpath.length()+1) -+ // If no runtime path needs to be changed, we are done. -+ if(rp_count == 0) - { -- if(emsg) -- { -- *emsg = "The replacement RPATH is too long."; -- } -- return false; -+ return true; - } - -- // Open the file for update and seek to the RPATH position. -+ // Open the file for update. - std::ofstream f(file.c_str(), - std::ios::in | std::ios::out | std::ios::binary); - if(!f) -@@ -2430,40 +2471,49 @@ bool cmSystemTools::ChangeRPath(std::string const& file, - } - return false; - } -- if(!f.seekp(rpathPosition)) -+ -+ // Store the new RPATH and RUNPATH strings. -+ for(int i=0; i < rp_count; ++i) - { -- if(emsg) -+ // Seek to the RPATH position. -+ if(!f.seekp(rp[i].Position)) - { -- *emsg = "Error seeking to RPATH position."; -+ if(emsg) -+ { -+ *emsg = "Error seeking to "; -+ *emsg += rp[i].Name; -+ *emsg += " position."; -+ } -+ return false; - } -- return false; -- } - -- // Write the new rpath. Follow it with enough null terminators to -- // fill the string table entry. -- f << rpath; -- for(unsigned long i=rpath.length(); i < rpathSize; ++i) -- { -- f << '\0'; -- } -+ // Write the new rpath. Follow it with enough null terminators to -+ // fill the string table entry. -+ f << rp[i].Value; -+ for(unsigned long j=rp[i].Value.length(); j < rp[i].Size; ++j) -+ { -+ f << '\0'; -+ } - -- // Make sure everything was okay. -- if(f) -- { -- if(changed) -+ // Make sure it wrote correctly. -+ if(!f) - { -- *changed = true; -+ if(emsg) -+ { -+ *emsg = "Error writing the new "; -+ *emsg += rp[i].Name; -+ *emsg += " string to the file."; -+ } -+ return false; - } -- return true; - } -- else -+ -+ // Everything was updated successfully. -+ if(changed) - { -- if(emsg) -- { -- *emsg = "Error writing the new rpath to the file."; -- } -- return false; -+ *changed = true; - } -+ return true; - #else - (void)file; - (void)oldRPath; -@@ -2475,57 +2525,95 @@ bool cmSystemTools::ChangeRPath(std::string const& file, - } - - //---------------------------------------------------------------------------- --bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg) -+bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, -+ bool* removed) - { - #if defined(CMAKE_USE_ELF_PARSER) -- unsigned long rpathPosition = 0; -- unsigned long rpathSize = 0; -- unsigned long rpathEntryPosition = 0; -+ if(removed) -+ { -+ *removed = false; -+ } -+ int zeroCount = 0; -+ unsigned long zeroPosition[2] = {0,0}; -+ unsigned long zeroSize[2] = {0,0}; -+ unsigned long bytesBegin = 0; - std::vector<char> bytes; - { - // Parse the ELF binary. - cmELF elf(file.c_str()); - -- // Get the RPATH or RUNPATH entry from it. -- cmELF::StringEntry const* se = elf.GetRPath(); -- if(!se) -+ // Get the RPATH and RUNPATH entries from it and sort them by index -+ // in the dynamic section header. -+ int se_count = 0; -+ cmELF::StringEntry const* se[2] = {0, 0}; -+ if(cmELF::StringEntry const* se_rpath = elf.GetRPath()) - { -- se = elf.GetRunPath(); -+ se[se_count++] = se_rpath; - } -- -- if(se) -+ if(cmELF::StringEntry const* se_runpath = elf.GetRunPath()) - { -- // Store information about the entry. -- rpathPosition = se->Position; -- rpathSize = se->Size; -- rpathEntryPosition = elf.GetDynamicEntryPosition(se->IndexInSection); -+ se[se_count++] = se_runpath; -+ } -+ if(se_count == 0) -+ { -+ // There is no RPATH or RUNPATH anyway. -+ return true; -+ } -+ if(se_count == 2 && se[1]->IndexInSection < se[0]->IndexInSection) -+ { -+ cmsys_stl::swap(se[0], se[1]); -+ } - -- // Get the file range containing the rest of the DYNAMIC table -- // after the RPATH entry. -- unsigned long nextEntryPosition = -- elf.GetDynamicEntryPosition(se->IndexInSection+1); -- unsigned int count = elf.GetDynamicEntryCount(); -- if(count == 0) -+ // Get the size of the dynamic section header. -+ unsigned int count = elf.GetDynamicEntryCount(); -+ if(count == 0) -+ { -+ // This should happen only for invalid ELF files where a DT_NULL -+ // appears before the end of the table. -+ if(emsg) - { -- // This should happen only for invalid ELF files where a DT_NULL -- // appears before the end of the table. -- if(emsg) -- { -- *emsg = "DYNAMIC section contains a DT_NULL before the end."; -- } -- return false; -+ *emsg = "DYNAMIC section contains a DT_NULL before the end."; - } -- unsigned long nullEntryPosition = elf.GetDynamicEntryPosition(count); -+ return false; -+ } -+ -+ // Save information about the string entries to be zeroed. -+ zeroCount = se_count; -+ for(int i=0; i < se_count; ++i) -+ { -+ zeroPosition[i] = se[i]->Position; -+ zeroSize[i] = se[i]->Size; -+ } -+ -+ // Get the range of file positions corresponding to each entry and -+ // the rest of the table after them. -+ unsigned long entryBegin[3] = {0,0,0}; -+ unsigned long entryEnd[2] = {0,0}; -+ for(int i=0; i < se_count; ++i) -+ { -+ entryBegin[i] = elf.GetDynamicEntryPosition(se[i]->IndexInSection); -+ entryEnd[i] = elf.GetDynamicEntryPosition(se[i]->IndexInSection+1); -+ } -+ entryBegin[se_count] = elf.GetDynamicEntryPosition(count); -+ -+ // The data are to be written over the old table entries starting at -+ // the first one being removed. -+ bytesBegin = entryBegin[0]; -+ unsigned long bytesEnd = entryBegin[se_count]; - -- // Allocate and fill a buffer with zeros. -- bytes.resize(nullEntryPosition - rpathEntryPosition, 0); -+ // Allocate a buffer to hold the part of the file to be written. -+ // Initialize it with zeros. -+ bytes.resize(bytesEnd - bytesBegin, 0); - -- // Read the part of the DYNAMIC section header that will move. -- // The remainder of the buffer will be left with zeros which -- // represent a DT_NULL entry. -- if(!elf.ReadBytes(nextEntryPosition, -- nullEntryPosition - nextEntryPosition, -- &bytes[0])) -+ // Read the part of the DYNAMIC section header that will move. -+ // The remainder of the buffer will be left with zeros which -+ // represent a DT_NULL entry. -+ char* data = &bytes[0]; -+ for(int i=0; i < se_count; ++i) -+ { -+ // Read data between the entries being removed. -+ unsigned long sz = entryBegin[i+1] - entryEnd[i]; -+ if(sz > 0 && !elf.ReadBytes(entryEnd[i], sz, data)) - { - if(emsg) - { -@@ -2533,11 +2621,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg) - } - return false; - } -- } -- else -- { -- // There is no RPATH or RUNPATH anyway. -- return true; -+ data += sz; - } - } - -@@ -2554,7 +2638,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg) - } - - // Write the new DYNAMIC table header. -- if(!f.seekp(rpathEntryPosition)) -+ if(!f.seekp(bytesBegin)) - { - if(emsg) - { -@@ -2571,36 +2655,41 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg) - return false; - } - -- // Fill the RPATH string with zero bytes. -- if(!f.seekp(rpathPosition)) -+ // Fill the RPATH and RUNPATH strings with zero bytes. -+ for(int i=0; i < zeroCount; ++i) - { -- if(emsg) -+ if(!f.seekp(zeroPosition[i])) - { -- *emsg = "Error seeking to RPATH position."; -+ if(emsg) -+ { -+ *emsg = "Error seeking to RPATH position."; -+ } -+ return false; -+ } -+ for(unsigned long j=0; j < zeroSize[i]; ++j) -+ { -+ f << '\0'; -+ } -+ if(!f) -+ { -+ if(emsg) -+ { -+ *emsg = "Error writing the empty rpath string to the file."; -+ } -+ return false; - } -- return false; -- } -- for(unsigned long i=0; i < rpathSize; ++i) -- { -- f << '\0'; - } - -- // Make sure everything was okay. -- if(f) -- { -- return true; -- } -- else -+ // Everything was updated successfully. -+ if(removed) - { -- if(emsg) -- { -- *emsg = "Error writing the empty rpath to the file."; -- } -- return false; -+ *removed = true; - } -+ return true; - #else - (void)file; - (void)emsg; -+ (void)removed; - return false; - #endif - } -diff --git cmake-2.6.1-orig/Source/cmSystemTools.h cmake-2.6.1/Source/cmSystemTools.h -index 493ff71..1ff12bf 100644 ---- cmake-2.6.1-orig/Source/cmSystemTools.h -+++ cmake-2.6.1/Source/cmSystemTools.h -@@ -396,7 +396,8 @@ public: - bool* changed = 0); - - /** Try to remove the RPATH from an ELF binary. */ -- static bool RemoveRPath(std::string const& file, std::string* emsg = 0); -+ static bool RemoveRPath(std::string const& file, std::string* emsg = 0, -+ bool* removed = 0); - - /** Check whether the RPATH in an ELF binary contains the path - given. */ |