Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 588440 | Differences between
and this patch

Collapse All | Expand All

(-)a/sys-boot/udk/Manifest (+3 lines)
Line 0 Link Here
1
DIST UDK2015.Complete.MyWorkSpace.zip 121736982 SHA256 ff11e68feafae13510ad5ee951bf7b219b3483ab335c1d0c85f45a5b7ba48b5e SHA512 7856a8f29296f817e8fd09d8eaf7207f4e25a13faa10936d1ceb10cb6a900be265379722c0ade0ef93b1c640fef8693667d2567962e3288b20ae77f607f03d39 WHIRLPOOL 8b1e283e0ae3ec422eea609a418784260119410a87c5397803730f1c73be0b113eec41ed4cd1920d32735a23377acd80bedf1867518733be6d698c3891775276
2
EBUILD udk-2015.ebuild 8244 SHA256 eeab4f546903d392592556b65f369ac8e8d4205069b26cece459d2526a6daac6 SHA512 c410f8d0b9eb8c942b5fbf7a2a9406864ffdcba0b839d47111ee7b06e56cd185648484c572529ad67d05ba9289d74c11fbbe7092fd9777784f943a1ac807a61b WHIRLPOOL 2ddebaedd3559a87cf045fbbe9ca249ed71bfd39494d28d5d9c76cd1df34baf8d1e2c9cf47f413aa8303bd615cd3feb1c28d57c20f5353e519352f1f0554b019
3
MISC metadata.xml 920 SHA256 3ddbcd56238b81a1c29f4e3dca296f8ef7168204af6c5e2443654dec2b0efd3e SHA512 565903822b180365e596dc8778061cf5a61a83a2b19b812be999a2147ec5d7d69398fdcfde334799c5ff33d01ce10719ad6d91fd9702ca3ee271069dfade40c3 WHIRLPOOL cc531ccfe01b7a49092ec71f7602180d5999d5fa1a3fd127ef61b22c6cbc2cad763ae9884f4a4737ad02e33ec1a63ace0558e74fdb761176562bbe87a11d4311
(-)a/sys-boot/udk/metadata.xml (+22 lines)
Line 0 Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
3
<pkgmetadata>
4
  <longdescription lang="en">
5
    Tianocore UEFI development kit, installed as classical Linux libraries and
6
	header files.
7
  </longdescription>
8
  <longdescription lang="fr">
9
    Kit de développement UEFI Tianocore, installé comme des bibliothèques et
10
	des fichiers d'en-tête Linux classiques.
11
  </longdescription>
12
  <use lang="en">
13
    <flag name="debug">Compile libraries with debug information.</flag>
14
    <flag name="doc">Install EDK2 documentation.</flag>
15
    <flag name="examples">Install usage examples.</flag>
16
  </use>
17
  <use lang="fr">
18
    <flag name="debug">Compile les bibliothèques avec les information de déboggage.</flag>
19
    <flag name="doc">Installe la documentation EDK2.</flag>
20
    <flag name="examples">Installe les exemples d'utilisation.</flag>
21
  </use>
22
</pkgmetadata>
(-)a/sys-boot/udk/udk-2015.ebuild (-1 / +262 lines)
Line 0 Link Here
0
- 
1
# Copyright 1999-2016 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Id$
4
5
EAPI=6
6
7
PYTHON_COMPAT=( python2_7 )
8
PYTHON_REQ_USE="sqlite"
9
10
inherit multiprocessing python-single-r1 versionator
11
12
DESCRIPTION="Tianocore UEFI Development kit"
13
HOMEPAGE="http://www.tianocore.org/edk2/"
14
MY_V="${PN^^}$(get_version_component_range 1)"
15
SRC_URI="https://github.com/tianocore/${PN}/releases/download/${MY_V}/${MY_V}.Complete.MyWorkSpace.zip"
16
17
LICENSE="BSD"
18
SLOT="0"
19
KEYWORDS="~amd64 ~x86"
20
IUSE="-debug doc examples"
21
22
DEPEND="app-arch/unzip dev-lang/nasm ${PYTHON_DEPS}"
23
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
24
25
S="${WORKDIR}/MyWorkSpace"
26
27
pkg_setup() {
28
	UNAME_ARCH=$(uname -m | perl -pe 's@i[3456789]86@IA32@' )
29
	if [[ ${UNAME_ARCH} == "x86_64" ]] || [[ ${UNAME_ARCH} == "amd64" ]] ; then
30
		export ARCH=X64
31
	else
32
		export ARCH=${UNAME_ARCH}
33
	fi
34
	use debug && export COMPILE_MODE="DEBUG" || export COMPILE_MODE="RELEASE"
35
	GCC_VERS=$(gcc --version | head -1 | sed "s/.*)//")
36
	GCC_VERS=$(get_version_component_range 1-2 ${GCC_VERS})
37
	GCC_VERS=$(delete_all_version_separators ${GCC_VERS})
38
	if [[ ${GCC_VERS} -lt 44 ]] || [[ ${GCC_VERS} -gt 49 ]]; then
39
		export TOOLCHAIN_TAG="ELFGCC"
40
	else
41
		export TOOLCHAIN_TAG="GCC${GCC_VERS}"
42
	fi
43
}
44
45
src_unpack() {
46
	unpack ${A}
47
	unpack "${WORKDIR}/${MY_V}.MyWorkSpace.zip"
48
	pushd "${S}"
49
	unpack "${WORKDIR}/BaseTools(Unix).tar"
50
	if use doc; then
51
		mkdir -p "${S}/doc"
52
		cd "${S}/doc"
53
		for f in "${WORKDIR}/Documents/"*" Document.zip"; do
54
			DOC_NAME=$(echo ${f} | perl -pe 's@^.*/([^/]*) Document.zip$@\1@')
55
			unpack "${WORKDIR}/Documents/${DOC_NAME} Document.zip"
56
			mv "${S}/doc/html" "${S}/doc/${DOC_NAME}"
57
		done
58
	fi
59
	popd
60
}
61
62
src_prepare() {
63
	eapply_user
64
	python_setup 'python2.7'
65
	# Base tools does not like parallel make
66
	emake -j1 -C BaseTools
67
	. edksetup.sh BaseTools
68
}
69
70
src_configure() {
71
	perl -i -pe 's@^(ACTIVE_PLATFORM\s*=).*$@\1 MdeModulePkg/MdeModulePkg.dsc@; \
72
		s/^(TARGET\s*=).*$/\1 '${COMPILE_MODE}'/; \
73
		s/^(TARGET_ARCH\s*=).*$/\1 '${ARCH}'/; \
74
		s/^(TOOL_CHAIN_TAG\s*=).*$/\1 '${TOOLCHAIN_TAG}'/; \
75
		s/^(MAX_CONCURRENT_THREAD_NUMBER\s*=).*$/\1 '$(makeopts_jobs)'/' \
76
		"${S}/Conf/target.txt" || die "Failed to configure target file"
77
}
78
79
src_compile() {
80
	if use examples; then
81
		BUILD_TARGET=all
82
	else
83
		BUILD_TARGET=libraries
84
	fi
85
	build ${BUILD_TARGET} || die "Failed to compile environment"
86
	# TODO Sometimes a package will not use the user's ${CFLAGS} or ${LDFLAGS}.
87
	# TODO This must be worked around.
88
	# TODO See https://devmanual.gentoo.org/ebuild-writing/functions/src_compile/building/index.html
89
}
90
91
src_install() {
92
	BUILD_DIR="${S}/Build/MdeModule/${COMPILE_MODE}_${TOOLCHAIN_TAG}/${ARCH}"
93
94
	for f in "${BUILD_DIR}"/*/Library/*/*/OUTPUT/*.lib; do
95
		newlib.a "${f}" lib$(basename "${f}" .lib).a
96
	done
97
	dolib "${S}/BaseTools/Scripts/GccBase.lds"
98
99
	INCLUDE_DEST="/usr/include/${PN}"
100
	for f in "" /Guid /IndustryStandard /Library /Pi /Ppi /Protocol /Uefi; do
101
		insinto "${INCLUDE_DEST}${f}"
102
		doins "${S}/MdePkg/Include${f}"/*.h
103
	done
104
	insinto "${INCLUDE_DEST}"
105
	doins "${S}/MdePkg/Include/${ARCH}"/*.h
106
	find "${S}" -name 'BaseTools' -prune -o -name 'MdePkg' -prune -o \
107
		-name 'CryptoPkg' -prune -o -type d -name Include \
108
		-exec find {} -maxdepth 0 \; \
109
		| while read hfile; do
110
		doins -r "${hfile}"/*
111
	done
112
113
	dobin "${S}/BaseTools/Source/C/bin/GenFw"
114
115
	if use doc; then
116
		docinto "html"
117
		# Document installation may be very long, so split it and display message
118
		for f in "${S}"/doc/*; do
119
			ebegin "Installing documentation for $(basename ${f}), please wait"
120
			dodoc -r "${f}"
121
			eend $?
122
		done
123
	fi
124
125
	if use examples; then
126
		EX_REBUILD_DIR="${S}/${P}-exemples"
127
		for f in "${S}/MdeModulePkg/Application"/*; do
128
			EX_NAME=$(basename "${f}")
129
			ebegin "Preparing ${EX_NAME} example"
130
			mkdir -p "${EX_REBUILD_DIR}/${EX_NAME}"
131
			EX_BUILD_DIR="${BUILD_DIR}/MdeModulePkg/Application"
132
			EX_BUILD_DIR="${EX_BUILD_DIR}/${EX_NAME}/${EX_NAME}"
133
			copySourceFiles "${f}" "${EX_REBUILD_DIR}/${EX_NAME}"
134
			copySourceFiles "${EX_BUILD_DIR}/DEBUG" "${EX_REBUILD_DIR}/${EX_NAME}"
135
			createMakefile "${EX_REBUILD_DIR}/${EX_NAME}/Makefile" \
136
				"${EX_NAME}" "${EX_BUILD_DIR}/GNUmakefile"
137
			tar -C "${EX_REBUILD_DIR}" -cf "${EX_REBUILD_DIR}/${EX_NAME}.tar" \
138
				"${EX_NAME}"
139
			eend $? "Failed to create example file"
140
		done
141
		docinto "examples"
142
		dodoc "${EX_REBUILD_DIR}"/*.tar
143
	fi
144
145
# TODO * QA Notice: The following files contain writable and executable sections
146
# TODO * !WX --- --- usr/lib64/libBaseLib.a:Thunk16.obj
147
# TODO * !WX --- --- usr/lib64/libBaseLib.a:SwitchStack.obj
148
# TODO * !WX --- --- usr/lib64/libBaseLib.a:SetJump.obj
149
# TODO * !WX --- --- usr/lib64/libBaseLib.a:LongJump.obj
150
# TODO * !WX --- --- usr/lib64/libBaseLib.a:EnableDisableInterrupts.obj
151
# TODO * !WX --- --- usr/lib64/libBaseLib.a:DisablePaging64.obj
152
# TODO * !WX --- --- usr/lib64/libBaseLib.a:CpuId.obj
153
# TODO * !WX --- --- usr/lib64/libBaseLib.a:CpuIdEx.obj
154
# TODO * !WX --- --- usr/lib64/libBaseLib.a:EnableCache.obj
155
# TODO * !WX --- --- usr/lib64/libBaseLib.a:DisableCache.obj
156
# TODO * QA Notice: Package triggers severe warnings which indicate that it
157
# TODO *            may exhibit random runtime failures.
158
# TODO * /usr/include/bits/string3.h:90:70: warning: call to void* __builtin___memset_chk(void*, int, long unsigned int, long unsigned int) will always overflow destination buffer
159
}
160
161
pkg_postinst() {
162
	elog "Installation done for ${ARCH}"
163
	use doc && \
164
		elog "You can find documentation in /usr/share/doc/${PF}/html"
165
	use examples && \
166
		elog "You can find examples in /usr/share/doc/${PF}/examples"
167
}
168
169
##
170
# Parameters :
171
# 1 - Path where to search for source files.
172
# 2 - Path where source files must be copied.
173
copySourceFiles() {
174
	while read -d '' -r filename; do
175
		DEST_FILE="${2}${filename#${1}}"
176
		mkdir -p $(dirname "${DEST_FILE}")
177
		mv "${filename}" "${DEST_FILE}"
178
	done < <(find "${1}" -name '*.h' -print0 -o -name '*.c' -print0)
179
}
180
181
##
182
# Parameters :
183
# 1 - Path of the file to create.
184
# 2 - Name of the module.
185
# 3 - Path of the generated Makefile.
186
createMakefile() {
187
	cat >${1} <<EOF
188
TOP := \$(abspath \$(dir \$(lastword \$(MAKEFILE_LIST))))
189
EXEC = ${2}.efi
190
SRC = \$(shell find \$(TOP) -type f -name '*.c')
191
OBJ = \$(SRC:.c=.o)
192
INC_DIR = /usr/include/${PN}
193
LIB_DIR = /usr/lib
194
STATIC_LIBRARY_FILES = \\
195
EOF
196
197
	perl -ne \
198
'if( m/^STATIC_LIBRARY_FILES\s*=/ ) {
199
	$static=1;
200
} elsif( $static ) {
201
	if( m!^\s*\$\(BIN_DIR\).*/([^/]*)\.lib! ) {
202
		print "\t\"-l${1}\" \\\n"
203
	} else {
204
		$static=0;
205
	}
206
}' >>${1} <${3}
207
208
	cat >>${1} <<EOF
209
210
EFI_LDS = \$(LIB_DIR)/GccBase.lds
211
212
EOF
213
	grep -e '^MODULE_TYPE\s*=' ${3} >>${1}
214
	grep -e '^IMAGE_ENTRY_POINT\s*=' ${3} >>${1}
215
	echo >>${1}
216
	grep -e '^CP\s*=' ${3} >>${1}
217
	grep -e '^RM\s*=' ${3} >>${1}
218
	grep -e '^CC\s*=' ${3} >>${1}
219
	grep -e '^DLINK\s*=' ${3} >>${1}
220
	grep -e '^OBJCOPY\s*=' ${3} >>${1}
221
	grep -e '^GENFW\s*=' ${3} >>${1}
222
	[[ $ARCH == X64 ]] && PECOFF_HEADER_SIZE='0x228' || PECOFF_HEADER_SIZE='0x220'
223
	cat >>${1} <<EOF
224
225
CC_FLAGS = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror \
226
-Wno-array-bounds -ffunction-sections -fdata-sections -c -iquote\$(TOP) \
227
-include AutoGen.h -I\$(INC_DIR) -DSTRING_ARRAY_NAME=${2}Strings -m64 \
228
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS \
229
-mno-red-zone -Wno-address -mcmodel=large -Wno-address \
230
-Wno-unused-but-set-variable
231
DLINK_FLAGS=-nostdlib -n -q --gc-sections --entry \$(IMAGE_ENTRY_POINT) \
232
-u \$(IMAGE_ENTRY_POINT) -melf_x86_64 --oformat=elf64-x86-64 -L \$(LIB_DIR) \
233
--script=\$(EFI_LDS) --defsym=PECOFF_HEADER_SIZE=${PECOFF_HEADER_SIZE}
234
EOF
235
	grep -e '^OBJCOPY_FLAGS\s*=' ${3} >>${1}
236
	grep -e '^GENFW_FLAGS\s*=' ${3} >>${1}
237
	cat >>${1} <<EOF
238
239
all:	\$(EXEC)
240
241
%.efi:	\$(OBJ)
242
	\$(DLINK) -o \$(@:.efi=.dll) \$(DLINK_FLAGS) \\
243
		--start-group \$(STATIC_LIBRARY_FILES) \$^ --end-group
244
	\$(OBJCOPY) \$(OBJCOPY_FLAGS) \$(@:.efi=.dll)
245
	\$(CP) \$(@:.efi=.dll) \$(@:.efi=.debug)
246
	\$(OBJCOPY) --strip-unneeded -R .eh_frame \$(@:.efi=.dll)
247
	\$(OBJCOPY) --add-gnu-debuglink=\$(@:.efi=.debug) \$(@:.efi=.dll)
248
	\$(GENFW) -e \$(MODULE_TYPE) -o \$@ \$(@:.efi=.dll) \$(GENFW_FLAGS)
249
	\$(RM) \$(@:.efi=.dll)
250
251
%.o:	%.c
252
	\$(CC) \$(CC_FLAGS) -o \$@ \$^
253
254
clean:
255
	\$(RM) *.o
256
257
mrproper: clean
258
	\$(RM) \$(EXEC) \$(EXEC:.efi=.debug)
259
260
.PHONY: all clean mrproper
261
EOF
262
}

Return to bug 588440