Gentoo Archives: gentoo-commits

From: Michael Palimaka <kensington@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/cmake/files/, dev-util/cmake/
Date: Sat, 10 Oct 2015 17:36:31
Message-Id: 1444498569.0ee1361bd482a7f8fb88b72c8975fdaebc4c4348.kensington@gentoo
1 commit: 0ee1361bd482a7f8fb88b72c8975fdaebc4c4348
2 Author: Michael Palimaka <kensington <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 10 17:26:35 2015 +0000
4 Commit: Michael Palimaka <kensington <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 10 17:36:09 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ee1361b
7
8 dev-util/cmake: add patch to ensure the correct version of Qt is always used
9
10 Gentoo-bug: 547222
11
12 Package-Manager: portage-2.2.20.1
13
14 dev-util/cmake/cmake-3.3.2-r1.ebuild | 200 +++++++++++++++++++++++++
15 dev-util/cmake/files/cmake-3.3.2-FindQt4.patch | 45 ++++++
16 2 files changed, 245 insertions(+)
17
18 diff --git a/dev-util/cmake/cmake-3.3.2-r1.ebuild b/dev-util/cmake/cmake-3.3.2-r1.ebuild
19 new file mode 100644
20 index 0000000..683b1fa
21 --- /dev/null
22 +++ b/dev-util/cmake/cmake-3.3.2-r1.ebuild
23 @@ -0,0 +1,200 @@
24 +# Copyright 1999-2015 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +# $Id$
27 +
28 +EAPI=5
29 +
30 +CMAKE_REMOVE_MODULES="no"
31 +inherit bash-completion-r1 elisp-common toolchain-funcs eutils versionator cmake-utils virtualx
32 +
33 +MY_P="${P/_/-}"
34 +
35 +DESCRIPTION="Cross platform Make"
36 +HOMEPAGE="http://www.cmake.org/"
37 +SRC_URI="http://www.cmake.org/files/v$(get_version_component_range 1-2)/${MY_P}.tar.gz
38 + http://www.cmake.org/gitweb?p=cmake.git;a=patch;h=b9ec9392da21a3421e48c6961976060d872faffb -> ${PN}-3.3.1-FindPkgConfig_remove_variable_dereference.patch"
39 +
40 +LICENSE="CMake"
41 +SLOT="0"
42 +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
43 +IUSE="doc emacs system-jsoncpp ncurses qt4 qt5"
44 +
45 +RDEPEND="
46 + >=app-arch/libarchive-3.0.0:=
47 + >=dev-libs/expat-2.0.1
48 + >=net-misc/curl-7.20.0-r1[ssl]
49 + sys-libs/zlib
50 + virtual/pkgconfig
51 + emacs? ( virtual/emacs )
52 + ncurses? ( sys-libs/ncurses:0= )
53 + qt4? (
54 + dev-qt/qtcore:4
55 + dev-qt/qtgui:4
56 + )
57 + qt5? (
58 + dev-qt/qtcore:5
59 + dev-qt/qtgui:5
60 + dev-qt/qtwidgets:5
61 + )
62 + system-jsoncpp? ( >=dev-libs/jsoncpp-0.6.0_rc2:0= )
63 +"
64 +DEPEND="${RDEPEND}
65 + doc? ( dev-python/sphinx )
66 +"
67 +
68 +S="${WORKDIR}/${MY_P}"
69 +
70 +SITEFILE="50${PN}-gentoo.el"
71 +
72 +CMAKE_BINARY="${S}/Bootstrap.cmk/cmake"
73 +
74 +PATCHES=(
75 + # prefix
76 + "${FILESDIR}"/${PN}-2.8.10-darwin-bundle.patch
77 + "${FILESDIR}"/${PN}-3.0.0-prefix-dirs.patch
78 + "${FILESDIR}"/${PN}-3.1.0-darwin-isysroot.patch
79 +
80 + # handle gentoo packaging in find modules
81 + "${FILESDIR}"/${PN}-2.8.12.1-FindImageMagick.patch
82 + "${FILESDIR}"/${PN}-3.0.0-FindBLAS.patch
83 + "${FILESDIR}"/${PN}-3.0.0-FindBoost-python.patch
84 + "${FILESDIR}"/${PN}-3.0.2-FindLAPACK.patch
85 + "${FILESDIR}"/${PN}-3.3.2-FindQt4.patch
86 +
87 + # respect python eclasses
88 + "${FILESDIR}"/${PN}-2.8.10.2-FindPythonLibs.patch
89 + "${FILESDIR}"/${PN}-3.1.0-FindPythonInterp.patch
90 +
91 + # upstream fixes (can usually be removed with a version bump)
92 + "${DISTDIR}"/${PN}-3.3.1-FindPkgConfig_remove_variable_dereference.patch
93 +)
94 +
95 +cmake_src_bootstrap() {
96 + # Cleanup args to extract only JOBS.
97 + # Because bootstrap does not know anything else.
98 + echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' > /dev/null
99 + if [ $? -eq 0 ]; then
100 + par_arg=$(echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' | tail -n1 | egrep -o '[[:digit:]]+')
101 + par_arg="--parallel=${par_arg}"
102 + else
103 + par_arg="--parallel=1"
104 + fi
105 +
106 + # execinfo.h on Solaris isn't quite what it is on Darwin
107 + if [[ ${CHOST} == *-solaris* ]] ; then
108 + sed -i -e 's/execinfo\.h/blablabla.h/' Source/kwsys/CMakeLists.txt || die
109 + fi
110 +
111 + tc-export CC CXX LD
112 +
113 + # bootstrap script isn't exactly /bin/sh compatible
114 + ${CONFIG_SHELL:-sh} ./bootstrap \
115 + --prefix="${T}/cmakestrap/" \
116 + ${par_arg} \
117 + || die "Bootstrap failed"
118 +}
119 +
120 +cmake_src_test() {
121 + # fix OutDir and SelectLibraryConfigurations tests
122 + # these are altered thanks to our eclass
123 + sed -i -e 's:#IGNORE ::g' \
124 + "${S}"/Tests/{OutDir,CMakeOnly/SelectLibraryConfigurations}/CMakeLists.txt \
125 + || die
126 +
127 + pushd "${BUILD_DIR}" > /dev/null
128 +
129 + local ctestargs
130 + [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure"
131 +
132 + # Excluded tests:
133 + # BootstrapTest: we actualy bootstrap it every time so why test it.
134 + # BundleUtilities: bundle creation broken
135 + # CTest.updatecvs: which fails to commit as root
136 + # Fortran: requires fortran
137 + # Qt4Deploy, which tries to break sandbox and ignores prefix
138 + # TestUpload, which requires network access
139 + "${BUILD_DIR}"/bin/ctest ${ctestargs} \
140 + -E "(BootstrapTest|BundleUtilities|CTest.UpdateCVS|Fortran|Qt4Deploy|TestUpload)" \
141 + || die "Tests failed"
142 +
143 + popd > /dev/null
144 +}
145 +
146 +src_prepare() {
147 + cmake-utils_src_prepare
148 +
149 + # disable running of cmake in boostrap command
150 + sed -i \
151 + -e '/"${cmake_bootstrap_dir}\/cmake"/s/^/#DONOTRUN /' \
152 + bootstrap || die "sed failed"
153 +
154 + # Add gcc libs to the default link paths
155 + sed -i \
156 + -e "s|@GENTOO_PORTAGE_GCCLIBDIR@|${EPREFIX}/usr/${CHOST}/lib/|g" \
157 + -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}/|g" \
158 + Modules/Platform/{UnixPaths,Darwin}.cmake || die "sed failed"
159 +
160 + cmake_src_bootstrap
161 +}
162 +
163 +src_configure() {
164 + local mycmakeargs=(
165 + -DCMAKE_USE_SYSTEM_LIBRARIES=ON
166 + -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=$(usex system-jsoncpp)
167 + -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr
168 + -DCMAKE_DOC_DIR=/share/doc/${PF}
169 + -DCMAKE_MAN_DIR=/share/man
170 + -DCMAKE_DATA_DIR=/share/${PN}
171 + -DSPHINX_MAN=$(usex doc)
172 + -DSPHINX_HTML=$(usex doc)
173 + $(cmake-utils_use_build ncurses CursesDialog)
174 + )
175 +
176 + if use qt4 || use qt5 ; then
177 + mycmakeargs+=(
178 + -DBUILD_QtDialog=ON
179 + $(cmake-utils_use_find_package qt5 Qt5Widgets)
180 + )
181 + fi
182 +
183 + cmake-utils_src_configure
184 +}
185 +
186 +src_compile() {
187 + cmake-utils_src_compile
188 + use emacs && elisp-compile Auxiliary/cmake-mode.el
189 +}
190 +
191 +src_test() {
192 + VIRTUALX_COMMAND="cmake_src_test" virtualmake
193 +}
194 +
195 +src_install() {
196 + cmake-utils_src_install
197 +
198 + if use emacs; then
199 + elisp-install ${PN} Auxiliary/cmake-mode.el Auxiliary/cmake-mode.elc
200 + elisp-site-file-install "${FILESDIR}/${SITEFILE}"
201 + fi
202 +
203 + insinto /usr/share/vim/vimfiles/syntax
204 + doins Auxiliary/cmake-syntax.vim
205 +
206 + insinto /usr/share/vim/vimfiles/indent
207 + doins Auxiliary/cmake-indent.vim
208 +
209 + insinto /usr/share/vim/vimfiles/ftdetect
210 + doins "${FILESDIR}/${PN}.vim"
211 +
212 + dobashcomp Auxiliary/bash-completion/{${PN},ctest,cpack}
213 +
214 + rm -rf "${D}"/usr/share/cmake/{completions,editors} || die
215 +}
216 +
217 +pkg_postinst() {
218 + use emacs && elisp-site-regen
219 +}
220 +
221 +pkg_postrm() {
222 + use emacs && elisp-site-regen
223 +}
224
225 diff --git a/dev-util/cmake/files/cmake-3.3.2-FindQt4.patch b/dev-util/cmake/files/cmake-3.3.2-FindQt4.patch
226 new file mode 100644
227 index 0000000..665c330
228 --- /dev/null
229 +++ b/dev-util/cmake/files/cmake-3.3.2-FindQt4.patch
230 @@ -0,0 +1,45 @@
231 +Ensure that the correct version of Qt is always used.
232 +
233 +With the introduction qt-4.8.6, Qt binaries were moved from /usr/bin to
234 +/usr/$(get_libdir)/qt4/bin, leaving behind in their place symlinks to qtchooser.
235 +
236 +There is no guarantee to which version of Qt these symlinks might point, so it
237 +is necessary to find the correct version explicitly.
238 +
239 +Once qmake is found, it is queried for the correct location of all other items.
240 +
241 +Gentoo-bug: 547222
242 +
243 +--- Modules/FindQt4.cmake
244 ++++ Modules/FindQt4.cmake
245 +@@ -482,13 +482,23 @@
246 +
247 + get_filename_component(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
248 +
249 +- find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
250 +- PATHS
251 +- ENV QTDIR
252 +- "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
253 +- PATH_SUFFIXES bin
254 +- DOC "The qmake executable for the Qt installation to use"
255 +- )
256 ++ if(CMAKE_BUILD_TYPE STREQUAL Gentoo)
257 ++ find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
258 ++ PATHS
259 ++ /usr/${CMAKE_INSTALL_LIBDIR}/qt4/bin
260 ++ /usr/bin
261 ++ NO_DEFAULT_PATH
262 ++ DOC "The qmake executable for the Qt installation to use"
263 ++ )
264 ++ else()
265 ++ find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
266 ++ PATHS
267 ++ ENV QTDIR
268 ++ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
269 ++ PATH_SUFFIXES bin
270 ++ DOC "The qmake executable for the Qt installation to use"
271 ++ )
272 ++ endif()
273 +
274 + set(major 0)
275 + if (QT_QMAKE_EXECUTABLE)