Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-boot/udk/, sys-boot/udk/files/
Date: Wed, 01 May 2019 21:42:05
Message-Id: 1556746887.b1193c44d34f7af290c04f4aaf8df0781c1c9836.gyakovlev@gentoo
1 commit: b1193c44d34f7af290c04f4aaf8df0781c1c9836
2 Author: Stéphane Veyret <sveyret <AT> gmail <DOT> com>
3 AuthorDate: Wed Apr 10 15:29:29 2019 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Wed May 1 21:41:27 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1193c44
7
8 sys-boot/udk: Bump to version 2018
9
10 Signed-off-by: Stéphane VEYRET <sveyret <AT> gmail.com>
11 Closes: https://bugs.gentoo.org/628300
12 Bug: https://bugs.gentoo.org/603986
13 Bug: https://bugs.gentoo.org/598042
14 Package-Manager: Portage-2.3.62, Repoman-2.3.11
15 Closes: https://github.com/gentoo/gentoo/pull/11655
16 Reviewed-by: Michał Górny <mgorny <AT> gentoo.org>
17 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
18
19 sys-boot/udk/Manifest | 2 +
20 sys-boot/udk/files/2018-makefile.template | 41 ++++++
21 sys-boot/udk/udk-2018.ebuild | 212 ++++++++++++++++++++++++++++++
22 3 files changed, 255 insertions(+)
23
24 diff --git a/sys-boot/udk/Manifest b/sys-boot/udk/Manifest
25 index e8605e43db6..5b45c5e5d81 100644
26 --- a/sys-boot/udk/Manifest
27 +++ b/sys-boot/udk/Manifest
28 @@ -1 +1,3 @@
29 DIST UDK2015.Complete.MyWorkSpace.zip 121736982 BLAKE2B b37bd9ead6ce2c665128199249483ecbcb0f410077d0ca61820bdccb7ae71f6dad870a3cf2dad79f997ad9114678fab3c15a17227ae33aa1ff66f9187aa3a568 SHA512 7856a8f29296f817e8fd09d8eaf7207f4e25a13faa10936d1ceb10cb6a900be265379722c0ade0ef93b1c640fef8693667d2567962e3288b20ae77f607f03d39
30 +DIST udk-2018-docs.zip 79352781 BLAKE2B 9d08579d4645121cabb7ac52850de6492f9990240da9236064352df0595867bfc6952c9858865a8ce1d81982ec0e2440dc19930a75595454257294462adc60d6 SHA512 6ba2d961f20267cafb94bd020e8fe71e1392f1f2cdbc5c9f0a43212253ddf137b3e12cc789299dfd1ea099bb1541703b995ae20d28f0275395f5f85ed0656954
31 +DIST udk-2018.tar.gz 38642782 BLAKE2B a10171659451d7d3df737066ec0471db1e5055bd52556d4d0654b244e827512db8d88e2b74b4dfe0189f768e0eab7a705aa32a720e047555995cf339ea50c62f SHA512 8fd9316f08a5c30f8684b2fde73906a943bb067ec91699f41796e27679af73dbc38efaa100a57d4b835656b402d9c08896abc5c10fd0d607a7e0173b3d7a60b2
32
33 diff --git a/sys-boot/udk/files/2018-makefile.template b/sys-boot/udk/files/2018-makefile.template
34 new file mode 100644
35 index 00000000000..049a94facd8
36 --- /dev/null
37 +++ b/sys-boot/udk/files/2018-makefile.template
38 @@ -0,0 +1,41 @@
39 +TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
40 +BASE_NAME = «MODULE»
41 +EXEC = «MODULE».efi
42 +SRC = $(shell find $(TOP) -type f -name '*.c')
43 +OBJ = $(SRC:.c=.o)
44 +INC_DIR = /usr/include/«PACKAGE_NAME»
45 +LIB_DIR = «LIB_DIR»
46 +DEST_DIR_DEBUG = .
47 +«STATIC_LIBS»
48 +
49 +EFI_LDS = «EFI_LDS»
50 +«MODULE_TYPE»
51 +«VARIABLES»
52 +
53 +comma:= ,
54 +empty:=
55 +space:= $(empty) $(empty)
56 +
57 +all: $(EXEC)
58 +
59 +%.efi: $(OBJ)
60 + $(DLINK) -o $(@:.efi=.dll) $(DLINK_FLAGS) \
61 + -Wl,--script,$(EFI_LDS) -Wl,--defsym=PECOFF_HEADER_SIZE=«PECOFF_HEADER_SIZE» \
62 + -Wl,$(subst $(space),$(comma),--start-group $(STATIC_LIBRARY_FILES)$^ --end-group)
63 + $(OBJCOPY) $(OBJCOPY_FLAGS) $(@:.efi=.dll)
64 + $(CP) $(@:.efi=.dll) $(@:.efi=.debug)
65 + $(OBJCOPY) --strip-unneeded -R .eh_frame $(@:.efi=.dll)
66 + $(OBJCOPY) --add-gnu-debuglink=$(@:.efi=.debug) $(@:.efi=.dll)
67 + $(GENFW) -e $(MODULE_TYPE) -o $@ $(@:.efi=.dll) $(GENFW_FLAGS)
68 + $(RM) $(@:.efi=.dll)
69 +
70 +%.o: %.c
71 + $(CC) $(CC_FLAGS) -I$(INC_DIR) -iquote$(TOP) -c -o $@ $^
72 +
73 +clean:
74 + $(RM) *.o
75 +
76 +mrproper: clean
77 + $(RM) $(EXEC) $(EXEC:.efi=.debug)
78 +
79 +.PHONY: all clean mrproper
80
81 diff --git a/sys-boot/udk/udk-2018.ebuild b/sys-boot/udk/udk-2018.ebuild
82 new file mode 100644
83 index 00000000000..d89fdb55e27
84 --- /dev/null
85 +++ b/sys-boot/udk/udk-2018.ebuild
86 @@ -0,0 +1,212 @@
87 +# Copyright 1999-2019 Gentoo Authors
88 +# Distributed under the terms of the GNU General Public License v2
89 +
90 +EAPI=7
91 +
92 +PYTHON_COMPAT=( python2_7 )
93 +PYTHON_REQ_USE="sqlite"
94 +
95 +inherit flag-o-matic multiprocessing python-single-r1 toolchain-funcs
96 +
97 +DESCRIPTION="Tianocore UEFI Development kit"
98 +HOMEPAGE="https://github.com/tianocore/tianocore.github.io/wiki/EDK-II"
99 +
100 +if [[ ${PV} == *9999* ]]; then
101 + inherit git-r3
102 + EGIT_REPO_URI="https://github.com/tianocore/edk2.git"
103 + KEYWORDS=""
104 +else
105 + MY_V="${PN^^}${PV}"
106 + SRC_URI="https://github.com/tianocore/edk2/archive/v${MY_V}.tar.gz -> ${P}.tar.gz
107 + doc? ( https://github.com/tianocore/edk2/releases/download/v${MY_V}/${MY_V}.Documents.zip -> ${P}-docs.zip )"
108 + S="${WORKDIR}/edk2-v${MY_V}"
109 + KEYWORDS="~amd64 ~x86"
110 +fi
111 +
112 +LICENSE="BSD-2"
113 +SLOT="0"
114 +IUSE="doc examples"
115 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
116 +RESTRICT="strip"
117 +
118 +RDEPEND="${PYTHON_DEPS}"
119 +DEPEND="${RDEPEND}
120 + >=dev-lang/nasm-2.14.02
121 + >=sys-power/iasl-20160729
122 + doc? ( app-arch/unzip )"
123 +
124 +DOCDIR="${WORKDIR}/Documents"
125 +
126 +# Generated libs for EFI can contain WX sections
127 +QA_EXECSTACK="
128 + usr/lib*/libBaseLib.a:*
129 + usr/lib*/libBaseIoLibIntrinsic.a:*
130 +"
131 +
132 +pkg_setup() {
133 + if [[ ${ARCH} == "amd64" ]]; then
134 + ARCH=X64
135 + elif [[ ${ARCH} == "x86" ]]; then
136 + ARCH=IA32
137 + fi
138 +
139 + # Select toolchain within predefined ones
140 + if tc-is-gcc; then
141 + TOOLCHAIN_TAG="GCC5"
142 + elif tc-is-clang; then
143 + TOOLCHAIN_TAG="CLANG38"
144 + else
145 + TOOLCHAIN_TAG="ELFGCC"
146 + fi
147 +}
148 +
149 +src_unpack() {
150 + default
151 +
152 + local doc_name
153 + local f
154 + if use doc; then
155 + pushd "${DOCDIR}" >/dev/null || die
156 + rm -f *.chm || die
157 + for f in *.zip; do
158 + unpack "${DOCDIR}/${f}"
159 + mv html "${f%.zip}" || die
160 + done
161 + rm -f *.zip || die
162 + popd >/dev/null || die
163 + fi
164 +}
165 +
166 +src_configure() {
167 + # Compile of Base Tools is required for further setting up the environment
168 + # Base tools does not like parallel make
169 + sed -e "s:^\(BUILD_CFLAGS\s*=\).*$:\1 ${CFLAGS} -MD -fshort-wchar -fno-strict-aliasing -nostdlib -c -fPIC:" \
170 + -i "BaseTools/Source/C/Makefiles/header.makefile" \
171 + || die "Failed to update makefile header"
172 + local make_flags=(
173 + BUILD_CC="$(tc-getBUILD_CC)"
174 + BUILD_CXX="$(tc-getBUILD_CXX)"
175 + BUILD_AS="$(tc-getBUILD_AS)"
176 + BUILD_AR="$(tc-getBUILD_AR)"
177 + BUILD_LD="$(tc-getBUILD_LD)"
178 + )
179 + emake "${make_flags[@]}" -j1 -C BaseTools
180 + . edksetup.sh
181 +
182 + # Update UDK parameter files
183 + sed -e "s:^\(ACTIVE_PLATFORM\s*=\).*$:\1 MdeModulePkg/MdeModulePkg.dsc:" \
184 + -e "s:^\(TARGET\s*=\).*$:\1 RELEASE:" \
185 + -e "s:^\(TARGET_ARCH\s*=\).*$:\1 ${ARCH}:" \
186 + -e "s:^\(TOOL_CHAIN_TAG\s*=\).*$:\1 ${TOOLCHAIN_TAG}:" \
187 + -e "s:^\(MAX_CONCURRENT_THREAD_NUMBER\s*=\).*$:\1 $(makeopts_jobs):" \
188 + -i "Conf/target.txt" || die "Failed to configure target file"
189 + sed -e "s:\(_\(CC\|ASM\|PP\|VFRPP\|ASLCC\|ASLPP\|DLINK\)_PATH\s*=\).*$:\1 $(tc-getCC):" \
190 + -e "s:\(_ASLDLINK_PATH\s*=\).*$:\1 $(tc-getLD):" \
191 + -e "s:\(_OBJCOPY_PATH\s*=\).*$:\1 $(tc-getOBJCOPY):" \
192 + -e "s:\(_RC_PATH\s*=\).*$:\1 $(tc-getOBJCOPY):" \
193 + -e "s:\(_SLINK_PATH\s*=\).*$:\1 $(tc-getAR):" \
194 + -i "Conf/tools_def.txt" \
195 + || die "Failed to prepare tools definition file"
196 +}
197 +
198 +src_compile() {
199 + build $(usex examples all libraries) || die "Failed to compile environment"
200 +
201 +# TODO * /var/tmp/portage/sys-apps/sandbox-2.10-r1/work/sandbox-2.10/libsandbox/trace.c:_do_ptrace():74: failure (Operation not permitted):
202 +# TODO * ISE:_do_ptrace: ptrace(PTRACE_TRACEME, ..., 0x0000000000000000, 0x0000000000000000): Operation not permitted
203 +}
204 +
205 +src_install() {
206 + local f
207 + local build_dir="${S}/Build/MdeModule/RELEASE_${TOOLCHAIN_TAG}/${ARCH}"
208 +
209 + for f in "${build_dir}"/*/Library/*/*/OUTPUT/*.lib; do
210 + local fn="lib${f##*/}"
211 + newlib.a "${f}" "${fn%.lib}.a"
212 + done
213 +
214 + insinto "/usr/share/${P}"
215 + doins "${S}/BaseTools/Scripts/GccBase.lds"
216 +
217 + insinto "/usr/include/${PN}"
218 + doins "${S}/MdePkg/Include/"*.h
219 + doins -r "${S}/MdePkg/Include/"{${ARCH}/.,Guid,IndustryStandard,Library,Pi,Ppi,Protocol,Uefi}
220 + local hfile
221 + while read -d '' -r hfile; do
222 + doins -r "${hfile}/."
223 + done < <(find "${S}" -name 'BaseTools' -prune -o -name 'MdePkg' -prune -o \
224 + -name 'CryptoPkg' -prune -o -type d -name Include -print0)
225 +
226 + dobin "${S}/BaseTools/Source/C/bin/GenFw"
227 +
228 + local HTML_DOCS
229 + use doc && HTML_DOCS=( "${DOCDIR}"/. )
230 + einstalldocs
231 +
232 + local ex_rebuild_dir
233 + local ex_name
234 + local ex_build_dir
235 + if use examples; then
236 + ex_rebuild_dir="${S}/${P}-exemples"
237 + for f in "${S}/MdeModulePkg/Application"/*; do
238 + ex_name="${f##*/}"
239 + ebegin "Install ${ex_name} example"
240 + mkdir -p "${ex_rebuild_dir}/${ex_name}" || die
241 + ex_build_dir="${build_dir}/MdeModulePkg/Application"
242 + ex_build_dir="${ex_build_dir}/${ex_name}/${ex_name}"
243 +
244 + copySourceFiles "${f}" "${ex_rebuild_dir}/${ex_name}"
245 + copySourceFiles "${ex_build_dir}/DEBUG" "${ex_rebuild_dir}/${ex_name}"
246 + createMakefile "${ex_rebuild_dir}/${ex_name}/Makefile" \
247 + "${ex_name}" "${ex_build_dir}/GNUmakefile"
248 +
249 + tar -C "${ex_rebuild_dir}" -cf "${ex_rebuild_dir}/${ex_name}.tar" \
250 + "${ex_name}" || die
251 +
252 + eend $?
253 + done
254 + docinto "examples"
255 + dodoc "${ex_rebuild_dir}"/*.tar
256 + fi
257 +}
258 +
259 +##
260 +# Parameters :
261 +# 1 - Path where to search for source files.
262 +# 2 - Path where source files must be copied.
263 +copySourceFiles() {
264 + local dest_file
265 + while read -d '' -r filename; do
266 + dest_file="${2}${filename#${1}}"
267 + mkdir -p "${dest_file%/*}" || die
268 + mv "${filename}" "${dest_file}" || die
269 + done < <(find "${1}" \( -name '*.h' -o -name '*.c' \) -print0)
270 +}
271 +
272 +##
273 +# Parameters :
274 +# 1 - Path of the file to create.
275 +# 2 - Name of the module.
276 +# 3 - Path of the generated Makefile.
277 +createMakefile() {
278 + local static_libs=$(sed -n '/^STATIC_LIBRARY_FILES\s*=/,/^\s*\$(OUTPUT_DIR)/{/^\s*\$(OUTPUT_DIR)/b;p}' ${3} \
279 + | sed -e 's:^\s*\$(BIN_DIR).*/\([^/]*\)\.lib:\t-l\1:' -e 's:\\$:\\\\\\n:' \
280 + | tr --delete '\n')
281 + local pecoff_header_size=$(grep -e '--defsym=PECOFF_HEADER_SIZE=' ${3} \
282 + | sed -e 's/^.*--defsym=PECOFF_HEADER_SIZE=\(\S*\).*$/\1/')
283 + local variables=$(grep -e '^IMAGE_ENTRY_POINT\s*=' -e '^CP\s*=' \
284 + -e '^RM\s*=' -e '^CC\s*=' -e '^DLINK\s*=' -e '^OBJCOPY\s*=' \
285 + -e '^GENFW\s*=' -e '^CC_FLAGS\s*=' -e '^DLINK_FLAGS\s*=' \
286 + -e '^OBJCOPY_FLAGS\s*=' -e '^GENFW_FLAGS\s*=' ${3} \
287 + | sed -e 's:$:\\n:' | tr --delete '\n')
288 + sed -e "s:«MODULE»:${2}:" \
289 + -e "s:«PACKAGE_NAME»:${PN}:" \
290 + -e "s:«LIB_DIR»:$(get_libdir):" \
291 + -e "s:«EFI_LDS»:/usr/share/${P}/GccBase.lds:" \
292 + -e "s:«STATIC_LIBS»:${static_libs}:" \
293 + -e "s:«MODULE_TYPE»:$(grep -e '^MODULE_TYPE\s*=' ${3} | tail -1):" \
294 + -e "s:«VARIABLES»:${variables}:" \
295 + -e "s:«PECOFF_HEADER_SIZE»:${pecoff_header_size}:" \
296 + "${FILESDIR}/${PV}-makefile.template" >${1} \
297 + || die "Failed to create Makefile"
298 +}