Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-electronics/kicad/files/, sci-electronics/kicad/
Date: Wed, 29 Jun 2016 17:57:08
Message-Id: 1467223007.f228caa38719ad848fa163366c8f96a4d9ded711.mgorny@gentoo
1 commit: f228caa38719ad848fa163366c8f96a4d9ded711
2 Author: Zoltan Puskas <zoltan <AT> sinustrom <DOT> info>
3 AuthorDate: Sun Jun 26 08:07:44 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 29 17:56:47 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f228caa3
7
8 sci-electronics/kicad: Fix swig import fixer script for build, #586406
9
10 Fix the broken swig import fixer script that did not work with
11 newer Python versions. Also correct ebuild licensing.
12
13 Bug: https://bugs.gentoo.org/586406
14 Closes: https://github.com/gentoo/gentoo/pull/1745
15 Package-Manager: portage-2.3.0_rc1
16
17 .../kicad/files/kicad-swig-import-helper.patch | 31 ++++
18 sci-electronics/kicad/kicad-4.0.2-r3.ebuild | 203 +++++++++++++++++++++
19 2 files changed, 234 insertions(+)
20
21 diff --git a/sci-electronics/kicad/files/kicad-swig-import-helper.patch b/sci-electronics/kicad/files/kicad-swig-import-helper.patch
22 new file mode 100644
23 index 0000000..9202acc
24 --- /dev/null
25 +++ b/sci-electronics/kicad/files/kicad-swig-import-helper.patch
26 @@ -0,0 +1,31 @@
27 +diff -Naur kicad-4.0.2-orig/scripting/build_tools/fix_swig_imports.py kicad-4.0.2/scripting/build_tools/fix_swig_imports.py
28 +--- kicad-4.0.2-orig/scripting/build_tools/fix_swig_imports.py 2016-02-13 13:14:42.000000000 -0800
29 ++++ kicad-4.0.2/scripting/build_tools/fix_swig_imports.py 2016-06-26 00:49:20.336661983 -0700
30 +@@ -37,7 +37,19 @@
31 + txt = ""
32 +
33 + for l in lines:
34 +- if l.startswith("if version_info >= (2,6,0):"): # ok with swig version <= 3.0.2
35 ++ if l.startswith("if _swig_python_version_info >= (2, 7, 0):"): # ok with swig version >= 3.0.10
36 ++ l = l.replace("_swig_python_version_info >= (2, 7, 0)","False")
37 ++ doneOk = True
38 ++ elif l.startswith("elif _swig_python_version_info >= (2, 6, 0):"): # needed with swig version >= 3.0.10
39 ++ l = l.replace("_swig_python_version_info >= (2, 6, 0)","False")
40 ++ doneOk = True
41 ++ if l.startswith("if version_info >= (2, 7, 0):"): # ok with swig version >= 3.0.9
42 ++ l = l.replace("version_info >= (2, 7, 0)","False")
43 ++ doneOk = True
44 ++ elif l.startswith("elif version_info >= (2, 6, 0):"): # needed with swig version >= 3.0.9
45 ++ l = l.replace("version_info >= (2, 6, 0)","False")
46 ++ doneOk = True
47 ++ elif l.startswith("if version_info >= (2,6,0):"): # ok with swig version <= 3.0.2
48 + l = l.replace("version_info >= (2,6,0)","False")
49 + doneOk = True
50 + elif l.startswith("if version_info >= (2, 6, 0):"): # needed with swig version 3.0.3
51 +@@ -60,6 +72,3 @@
52 +
53 +
54 + exit(0)
55 +-
56 +-
57 +-
58
59 diff --git a/sci-electronics/kicad/kicad-4.0.2-r3.ebuild b/sci-electronics/kicad/kicad-4.0.2-r3.ebuild
60 new file mode 100644
61 index 0000000..998e630
62 --- /dev/null
63 +++ b/sci-electronics/kicad/kicad-4.0.2-r3.ebuild
64 @@ -0,0 +1,203 @@
65 +# Copyright 1999-2016 Gentoo Foundation
66 +# Distributed under the terms of the GNU General Public License v2
67 +# $Id$
68 +
69 +EAPI=5
70 +PYTHON_COMPAT=( python2_7 )
71 +
72 +WX_GTK_VER="3.0"
73 +
74 +inherit cmake-utils flag-o-matic gnome2-utils python-single-r1 vcs-snapshot wxwidgets versionator xdg
75 +
76 +DESCRIPTION="Electronic Schematic and PCB design tools."
77 +HOMEPAGE="http://www.kicad-pcb.org"
78 +LIBCONTEXT_COMMIT="3d92a1a50f4749b5a92131a957c9615473be85b4"
79 +
80 +SERIES=$(get_version_component_range 1-2)
81 +
82 +SRC_URI="https://launchpad.net/${PN}/${SERIES}/${PV}/+download/${P}.tar.xz
83 + http://downloads.kicad-pcb.org/libraries/${PN}-footprints-${PV}.tar.gz
84 + !minimal? ( https://github.com/KiCad/${PN}-library/archive/${PV}.tar.gz -> ${P}-library.tar.gz )
85 + i18n? ( https://github.com/KiCad/${PN}-i18n/archive/${PV}.tar.gz -> ${P}-i18n.tar.gz )
86 + https://github.com/twlostow/libcontext/archive/${LIBCONTEXT_COMMIT}.tar.gz -> ${PN}-libcontext.tar.gz"
87 +
88 +LICENSE="GPL-2+ GPL-3+ Boost-1.0"
89 +SLOT="0"
90 +KEYWORDS="~amd64 ~x86"
91 +IUSE="debug doc examples github i18n minimal +python webkit"
92 +LANGS="bg ca cs de el es fi fr hu it ja ko nl pl pt ru sk sl sv zh_CN"
93 +for lang in ${LANGS} ; do
94 + IUSE="${IUSE} linguas_${lang}"
95 +done
96 +unset lang
97 +unset LANGS
98 +
99 +REQUIRED_USE="
100 + github? ( webkit )
101 + python? ( ${PYTHON_REQUIRED_USE} )"
102 +
103 +CDEPEND="x11-libs/wxGTK:${WX_GTK_VER}[X,opengl,webkit?]
104 + python? (
105 + dev-python/wxpython:${WX_GTK_VER}[opengl,${PYTHON_USEDEP}]
106 + ${PYTHON_DEPS}
107 + )
108 + >=dev-libs/boost-1.56[nls,threads,python?]
109 + github? ( dev-libs/openssl:0 )
110 + media-libs/glew
111 + media-libs/freeglut
112 + media-libs/mesa
113 + sys-libs/zlib
114 + x11-libs/cairo"
115 +DEPEND="${CDEPEND}
116 + doc? ( app-doc/doxygen )
117 + i18n? ( virtual/libintl )
118 + python? ( dev-lang/swig:0 )
119 + app-text/dos2unix"
120 +RDEPEND="${CDEPEND}
121 + sci-electronics/electronics-menu"
122 +
123 +pkg_setup() {
124 + python-single-r1_pkg_setup
125 +}
126 +
127 +src_prepare() {
128 + xdg_src_prepare
129 +
130 + # Add separated out libcontext files and patch source to use them
131 + mkdir -p "${S}/common/system/" || die "mkdir failed"
132 + mkdir -p "${S}/include/system/" || die "mkdir failed"
133 + cp "${WORKDIR}/${PN}-libcontext/libcontext.cpp" "${S}/common/system/libcontext.cpp" || die "cp failed"
134 + cp "${WORKDIR}/${PN}-libcontext/libcontext.h" "${S}/include/system/libcontext.h" || die "cp failed"
135 + # Path source to use new "built in" libcontext. Also patch libcontext.cpp to have correct include file.
136 + # Path must be applied after new libcontext files have been copied to the kicad source directory.
137 + epatch "${FILESDIR}/${PN}-boost-context.patch"
138 + # Patch python swig import fixer build script
139 + epatch "${FILESDIR}/${PN}-swig-import-helper.patch"
140 +
141 + # remove all the non unix file endings
142 + find "${S}" -type f -name "*.desktop" | xargs -n1 dos2unix
143 + assert "dos2unix failed"
144 +
145 + # Handle optional minimal install.
146 + if use minimal; then
147 + # remove templates as they are not needed to run binaries
148 + sed -e '/add_subdirectory( template )/d' -i CMakeLists.txt || die "sed failed"
149 + else
150 + # create a link to the parts library in the main project folder
151 + ln -s "${WORKDIR}/${P}-library" "${S}/${PN}-library" || die "ln failed"
152 + # create a link to the footprints library and add cmake build rule for it
153 + ln -s "${WORKDIR}/${PN}-footprints-${PV}" "${S}/${PN}-footprints" || die "ln failed"
154 + cp "${FILESDIR}/${PN}-footprints-cmakelists.txt" "${WORKDIR}/${PN}-footprints-${PV}/CMakeLists.txt" || die "cp failed"
155 + # add the libraries directory to cmake as a subproject to build
156 + sed "/add_subdirectory( bitmaps_png )/a add_subdirectory( ${PN}-library )" -i CMakeLists.txt || die "sed failed"
157 + # add the footprints directory to cmake as a subproject to build
158 + sed "/add_subdirectory( ${PN}-library )/a add_subdirectory( ${PN}-footprints )" -i CMakeLists.txt || die "sed failed"
159 + # remove duplicate uninstall directions for the library module
160 + sed '/make uninstall/,/# /d' -i ${PN}-library/CMakeLists.txt || die "sed failed"
161 + fi
162 +
163 + # Add internationalization for the GUI
164 + if use i18n; then
165 + # create a link to the translations library in the main project folder
166 + ln -s "${WORKDIR}/${P}-i18n" "${S}/${PN}-i18n" || die "ln failed"
167 + # Remove unused languages. Project generates only languages specified in the
168 + # file in LINGUAS in the subproject folder. By default all languages are added
169 + # so we sed out the unused ones based on the user linguas_* settings.
170 + local lang
171 + for lang in ${LANGS}; do
172 + if ! use linguas_${lang}; then
173 + sed "/${lang}/d" -i ${PN}-i18n/LINGUAS || die "sed failed"
174 + fi
175 + done
176 + # cmakelists does not respect our build dir variables, so make it point to the right location
177 + sed "s|\${CMAKE_BINARY_DIR}|${WORKDIR}/${P}_build|g" -i ${PN}-i18n/CMakeLists.txt || die "sed failed"
178 + # we also make from the master project so the source dir is understood incorretly, replace that too
179 + sed "s|\${CMAKE_SOURCE_DIR}/\${LANG}|\${CMAKE_SOURCE_DIR}/${PN}-i18n/\${LANG}|g" -i ${PN}-i18n/CMakeLists.txt || die "sed failed"
180 + # add the translations directory to cmake as a subproject to build
181 + sed "/add_subdirectory( bitmaps_png )/a add_subdirectory( ${PN}-i18n )" -i CMakeLists.txt || die "sed failed"
182 + # remove duplicate uninstall directions for the translation module
183 + sed '/make uninstall/,$d' -i ${PN}-i18n/CMakeLists.txt || die "sed failed"
184 + fi
185 +
186 + # Install examples in the right place if requested
187 + if use examples; then
188 + # install demos into the examples folder too
189 + sed -e 's:${KICAD_DATA}/demos:${KICAD_DOCS}/examples:' -i CMakeLists.txt || die "sed failed"
190 + else
191 + # remove additional demos/examples as its not strictly required to run the binaries
192 + sed -e '/add_subdirectory( demos )/d' -i CMakeLists.txt || die "sed failed"
193 + fi
194 +
195 + # Add important missing doc files
196 + sed -e 's/INSTALL.txt/AUTHORS.txt CHANGELOG.txt README.txt TODO.txt/' -i CMakeLists.txt || die "sed failed"
197 +}
198 +
199 +src_configure() {
200 + local mycmakeargs=(
201 + -DPYTHON_DEST="$(python_get_sitedir)"
202 + -DPYTHON_EXECUTABLE="${PYTHON}"
203 + -DPYTHON_INCLUDE_DIR="$(python_get_includedir)"
204 + -DPYTHON_LIBRARY="$(python_get_library_path)"
205 + -DKICAD_DOCS="/usr/share/doc/${PF}"
206 + -DKICAD_HELP="/usr/share/doc/${PF}/help"
207 + -DKICAD_REPO_NAME="stable"
208 + -DKICAD_BUILD_VERSION="${PV}"
209 + -DwxUSE_UNICODE=ON
210 + -DKICAD_SKIP_BOOST=ON
211 + $(cmake-utils_use github BUILD_GITHUB_PLUGIN)
212 + $(cmake-utils_use python KICAD_SCRIPTING)
213 + $(cmake-utils_use python KICAD_SCRIPTING_MODULES)
214 + $(cmake-utils_use python KICAD_SCRIPTING_WXPYTHON)
215 + $(cmake-utils_use webkit KICAD_USE_WEBKIT)
216 + $(usex i18n "-DKICAD_I18N_UNIX_STRICT_PATH=1" "")
217 + )
218 + if use debug; then
219 + append-cxxflags "-DDEBUG"
220 + append-cflags "-DDEBUG"
221 + fi
222 + cmake-utils_src_configure
223 +}
224 +
225 +src_compile() {
226 + cmake-utils_src_compile
227 + if use doc; then
228 + doxygen Doxyfile || die "doxygen failed"
229 + fi
230 +}
231 +
232 +src_install() {
233 + cmake-utils_src_install
234 + use python && python_optimize
235 + if use doc ; then
236 + dodoc uncrustify.cfg
237 + cd Documentation || die "cd failed"
238 + dodoc -r GUI_Translation_HOWTO.pdf guidelines/UIpolicies.txt doxygen/.
239 + fi
240 +}
241 +
242 +pkg_preinst() {
243 + xdg_pkg_preinst
244 + gnome2_icon_savelist
245 +}
246 +
247 +pkg_postinst() {
248 + xdg_pkg_postinst
249 + gnome2_icon_cache_update
250 +
251 + if use minimal ; then
252 + ewarn "If the schematic and/or board editors complain about missing libraries when you"
253 + ewarn "open old projects, you will have to take one or more of the following actions :"
254 + ewarn "- Install the missing libraries manually."
255 + ewarn "- Remove the libraries from the 'Libs and Dir' preferences."
256 + ewarn "- Fix the libraries' locations in the 'Libs and Dir' preferences."
257 + ewarn "- Emerge ${PN} without the 'minimal' USE flag."
258 + fi
259 + elog ""
260 + elog "You may want to emerge media-gfx/wings if you want to create 3D models of components."
261 + elog "For help and extended documentation emerge app-doc/kicad-doc."
262 +}
263 +
264 +pkg_postrm() {
265 + xdg_pkg_postrm
266 + gnome2_icon_cache_update
267 +}