1 |
commit: 6cc95d998b2ca6fc6972ff33794d04c81f2ee362 |
2 |
Author: Stéphane Veyret <sveyret <AT> gmail <DOT> com> |
3 |
AuthorDate: Sun Jun 2 18:23:32 2019 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jul 5 20:31:22 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6cc95d99 |
7 |
|
8 |
sys-boot/udk: Simplify udk installation |
9 |
|
10 |
Signed-off-by: Stéphane VEYRET <sveyret <AT> gmail.com> |
11 |
Closes: https://bugs.gentoo.org/687222 |
12 |
Package-Manager: Portage-2.3.66, Repoman-2.3.11 |
13 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
14 |
|
15 |
sys-boot/udk/files/udk-workspace.template | 63 +++++++++++++ |
16 |
sys-boot/udk/udk-2018-r1.ebuild | 146 ++++++++++++++++++++++++++++++ |
17 |
2 files changed, 209 insertions(+) |
18 |
|
19 |
diff --git a/sys-boot/udk/files/udk-workspace.template b/sys-boot/udk/files/udk-workspace.template |
20 |
new file mode 100644 |
21 |
index 00000000000..e119c3ae1a3 |
22 |
--- /dev/null |
23 |
+++ b/sys-boot/udk/files/udk-workspace.template |
24 |
@@ -0,0 +1,63 @@ |
25 |
+#!/bin/bash |
26 |
+# Copyright 1999-2019 Gentoo Authors |
27 |
+# Distributed under the terms of the GNU General Public License v2 |
28 |
+ |
29 |
+SCRIPT_NAME='udk-workspace' |
30 |
+[ -n "${BASH_SOURCE}" ] && SCRIPT_NAME="${BASH_SOURCE}" |
31 |
+ |
32 |
+show_usage() { |
33 |
+ if [ ! -z "${1}" ]; then |
34 |
+ echo "${1}" >&2 |
35 |
+ echo >&2 |
36 |
+ fi |
37 |
+ echo "Usage:" |
38 |
+ echo ". ${SCRIPT_NAME} [folder]" |
39 |
+ echo "where folder is the workspace folder - current directory is used if unspecified" |
40 |
+} |
41 |
+ |
42 |
+create_workspace() { |
43 |
+ local workspace_dir="${PWD}" |
44 |
+ if [ ! -z "${1}" ]; then |
45 |
+ workspace_dir="${1}" |
46 |
+ if ! mkdir -p "${1}"; then |
47 |
+ show_usage "Cannot create directory ${1}" |
48 |
+ return 1 |
49 |
+ fi |
50 |
+ fi |
51 |
+ |
52 |
+ pushd "${workspace_dir}" >/dev/null |
53 |
+ if ! mkdir -p Conf; then |
54 |
+ show_usage "Cannot create configuration directory" |
55 |
+ return 1 |
56 |
+ fi |
57 |
+ export WORKSPACE="${PWD}" |
58 |
+ popd >/dev/null |
59 |
+} |
60 |
+ |
61 |
+if [ "${1}" = "-h" ] || [ "${1}" = "--help" ]; then |
62 |
+ show_usage |
63 |
+ # Script may have been sourced |
64 |
+ return 0 2>/dev/null |
65 |
+ exit 0 |
66 |
+elif [ "${SCRIPT_NAME}" = "${0}" ]; then |
67 |
+ show_usage "Script must be sourced" |
68 |
+ exit 1 |
69 |
+elif [ $# -gt 1 ]; then |
70 |
+ show_usage "Too many arguments" |
71 |
+ return 1 |
72 |
+fi |
73 |
+ |
74 |
+if ! create_workspace "${1}"; then |
75 |
+ return 1 |
76 |
+fi |
77 |
+unset -f show_usage |
78 |
+unset -f create_workspace |
79 |
+shift $# |
80 |
+ |
81 |
+export EDK_TOOLS_PATH="{EDK_BASE}/BaseTools" |
82 |
+. "{EDK_BASE}/edksetup.sh" |
83 |
+ |
84 |
+echo "Do not forget to call this script each time you open a new terminal or work on" |
85 |
+echo "another workspace." |
86 |
+echo "For more information, type:" |
87 |
+echo "${SCRIPT_NAME} --help" |
88 |
|
89 |
diff --git a/sys-boot/udk/udk-2018-r1.ebuild b/sys-boot/udk/udk-2018-r1.ebuild |
90 |
new file mode 100644 |
91 |
index 00000000000..89f40f3e1a5 |
92 |
--- /dev/null |
93 |
+++ b/sys-boot/udk/udk-2018-r1.ebuild |
94 |
@@ -0,0 +1,146 @@ |
95 |
+# Copyright 1999-2019 Gentoo Authors |
96 |
+# Distributed under the terms of the GNU General Public License v2 |
97 |
+ |
98 |
+EAPI=7 |
99 |
+ |
100 |
+PYTHON_COMPAT=( python2_7 ) |
101 |
+PYTHON_REQ_USE="sqlite" |
102 |
+ |
103 |
+inherit multiprocessing python-single-r1 toolchain-funcs |
104 |
+ |
105 |
+DESCRIPTION="Tianocore UEFI Development kit" |
106 |
+HOMEPAGE="https://github.com/tianocore/tianocore.github.io/wiki/EDK-II" |
107 |
+ |
108 |
+if [[ ${PV} == *9999* ]]; then |
109 |
+ inherit git-r3 |
110 |
+ EGIT_REPO_URI="https://github.com/tianocore/edk2.git" |
111 |
+ KEYWORDS="" |
112 |
+else |
113 |
+ MY_V="${PN^^}${PV}" |
114 |
+ SRC_URI="https://github.com/tianocore/edk2/archive/v${MY_V}.tar.gz -> ${P}.tar.gz |
115 |
+ doc? ( https://github.com/tianocore/edk2/releases/download/v${MY_V}/${MY_V}.Documents.zip -> ${P}-docs.zip )" |
116 |
+ S="${WORKDIR}/edk2-v${MY_V}" |
117 |
+ KEYWORDS="~amd64 ~x86" |
118 |
+fi |
119 |
+ |
120 |
+LICENSE="BSD-2" |
121 |
+SLOT="0" |
122 |
+IUSE="doc" |
123 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
124 |
+RESTRICT="strip" |
125 |
+ |
126 |
+RDEPEND="${PYTHON_DEPS}" |
127 |
+DEPEND="${RDEPEND} |
128 |
+ >=dev-lang/nasm-2.14.02 |
129 |
+ >=sys-power/iasl-20160729 |
130 |
+ doc? ( app-arch/unzip )" |
131 |
+ |
132 |
+DOCDIR="${WORKDIR}/Documents" |
133 |
+ |
134 |
+# EFI pre-build libs |
135 |
+QA_PREBUILT=" |
136 |
+ usr/lib/${P}/BeagleBoardPkg/Debugger_scripts/rvi_dummy.axf |
137 |
+ usr/lib/${P}/ArmPkg/Library/GccLto/*.a |
138 |
+" |
139 |
+# GenBiosId is built upstream |
140 |
+# VfrCompile does not use LDFLAGS but next upsteam version should change this |
141 |
+QA_FLAGS_IGNORED=" |
142 |
+ usr/lib/udk-2018/BaseTools/Source/C/bin/VfrCompile |
143 |
+ usr/lib/${P}/Vlv2TbltDevicePkg/GenBiosId |
144 |
+" |
145 |
+ |
146 |
+pkg_setup() { |
147 |
+ if use x86; then |
148 |
+ EFIARCH=IA32 |
149 |
+ elif use amd64; then |
150 |
+ EFIARCH=X64 |
151 |
+ fi |
152 |
+ |
153 |
+ # Select toolchain within predefined ones |
154 |
+ if tc-is-gcc; then |
155 |
+ TOOLCHAIN_TAG="GCC5" |
156 |
+ elif tc-is-clang; then |
157 |
+ TOOLCHAIN_TAG="CLANG38" |
158 |
+ else |
159 |
+ TOOLCHAIN_TAG="ELFGCC" |
160 |
+ fi |
161 |
+} |
162 |
+ |
163 |
+src_unpack() { |
164 |
+ default |
165 |
+ |
166 |
+ local doc_name |
167 |
+ local f |
168 |
+ if use doc; then |
169 |
+ pushd "${DOCDIR}" >/dev/null || die |
170 |
+ rm -f *.chm || die |
171 |
+ for f in *.zip; do |
172 |
+ unpack "${DOCDIR}/${f}" |
173 |
+ mv html "${f%.zip}" || die |
174 |
+ done |
175 |
+ rm -f *.zip || die |
176 |
+ popd >/dev/null || die |
177 |
+ fi |
178 |
+} |
179 |
+ |
180 |
+src_configure() { |
181 |
+ sed -e "s:^\(BUILD_CFLAGS\s*=\).*$:\1 ${CFLAGS} -MD -fshort-wchar -fno-strict-aliasing -nostdlib -c -fPIC:" \ |
182 |
+ -e "s:^\(BUILD_LFLAGS\s*=\).*$:\1 ${LDFLAGS}:" \ |
183 |
+ -e "s:^\(BUILD_CXXFLAGS\s*=\).*$:\1 ${CXXFLAGS} -Wno-unused-result:" \ |
184 |
+ -i "BaseTools/Source/C/Makefiles/header.makefile" \ |
185 |
+ || die "Failed to update makefile header" |
186 |
+} |
187 |
+ |
188 |
+src_compile() { |
189 |
+ local make_flags=( |
190 |
+ BUILD_CC="$(tc-getBUILD_CC)" |
191 |
+ BUILD_CXX="$(tc-getBUILD_CXX)" |
192 |
+ BUILD_AS="$(tc-getBUILD_AS)" |
193 |
+ BUILD_AR="$(tc-getBUILD_AR)" |
194 |
+ BUILD_LD="$(tc-getBUILD_LD)" |
195 |
+ ) |
196 |
+ # Base tools does not like parallel make |
197 |
+ emake "${make_flags[@]}" -j1 -C BaseTools |
198 |
+ |
199 |
+ # Update template parameter files |
200 |
+ sed -e "s:^\(ACTIVE_PLATFORM\s*=\).*$:\1 MdeModulePkg/MdeModulePkg.dsc:" \ |
201 |
+ -e "s:^\(TARGET\s*=\).*$:\1 RELEASE:" \ |
202 |
+ -e "s:^\(TARGET_ARCH\s*=\).*$:\1 ${EFIARCH}:" \ |
203 |
+ -e "s:^\(TOOL_CHAIN_TAG\s*=\).*$:\1 ${TOOLCHAIN_TAG}:" \ |
204 |
+ -e "s:^\(MAX_CONCURRENT_THREAD_NUMBER\s*=\).*$:\1 $(makeopts_jobs):" \ |
205 |
+ -i "BaseTools/Conf/target.template" || die "Failed to configure target file" |
206 |
+ |
207 |
+ # Clean unneeded files |
208 |
+ find . -name '*.bat' -o -name '*.exe' -exec rm -f {} \; || die |
209 |
+ find ./BaseTools/Source/C -mindepth 1 -maxdepth 1 \! -name 'bin' -exec rm -rf {} \; || die |
210 |
+ |
211 |
+ # Upsteam hack (symbolic link) should only be created if needed |
212 |
+ rm "${S}/EmulatorPkg/Unix/Host/X11IncludeHack" || die |
213 |
+ |
214 |
+ # Create workspace script file |
215 |
+ sed -e "s:{EDK_BASE}:${EPREFIX}/usr/lib/${P}:" \ |
216 |
+ "${FILESDIR}"/udk-workspace.template \ |
217 |
+ > "${T}/udk-workspace" || die "Failed to build udk-workspace" |
218 |
+} |
219 |
+ |
220 |
+src_install() { |
221 |
+ dobin "${T}/udk-workspace" |
222 |
+ |
223 |
+ # Use mkdir && cp here as doins does not preserve execution bits |
224 |
+ mkdir -p "${ED}/usr/lib/${P}" || die |
225 |
+ cp -pR "${S}"/* "${D}/usr/lib/${P}" || die |
226 |
+ dosym "${P}" "/usr/lib/${PN}" |
227 |
+ |
228 |
+ local HTML_DOCS |
229 |
+ use doc && HTML_DOCS=( "${DOCDIR}"/. ) |
230 |
+ einstalldocs |
231 |
+} |
232 |
+ |
233 |
+pkg_postinst() { |
234 |
+ elog "To create a new workspace, execute:" |
235 |
+ elog " . udk-workspace [workspace_dir]" |
236 |
+ elog "You can link appropriate packages to your workspace. For example," |
237 |
+ elog "in order to build MdeModulePkg and examples, you can try:" |
238 |
+ elog " ln -s \"${EROOT}/usr/lib/${P}/\"Mde{Module,}Pkg ." |
239 |
+ elog " build -a ${EFIARCH} all" |
240 |
+} |