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 (+1 lines)
Line 0 Link Here
1
DIST UDK2015.Complete.MyWorkSpace.zip 121736982 SHA256 ff11e68feafae13510ad5ee951bf7b219b3483ab335c1d0c85f45a5b7ba48b5e SHA512 7856a8f29296f817e8fd09d8eaf7207f4e25a13faa10936d1ceb10cb6a900be265379722c0ade0ef93b1c640fef8693667d2567962e3288b20ae77f607f03d39 WHIRLPOOL 8b1e283e0ae3ec422eea609a418784260119410a87c5397803730f1c73be0b113eec41ed4cd1920d32735a23377acd80bedf1867518733be6d698c3891775276
(-)a/sys-boot/udk/files/2015-makefile.template (+55 lines)
Line 0 Link Here
1
TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
2
EXEC = «MODULE».efi
3
SRC = $(shell find $(TOP) -type f -name '*.c')
4
OBJ = $(SRC:.c=.o)
5
INC_DIR = /usr/include/«PACKAGE_NAME»
6
LIB_DIR = /usr/lib
7
«STATIC_LIBS»
8
9
EFI_LDS = $(LIB_DIR)/GccBase.lds
10
11
«MODULE_TYPE»
12
«IMAGE_ENTRY_POINT»
13
14
«CP»
15
«RM»
16
«CC»
17
«DLINK»
18
«OBJCOPY»
19
«GENFW»
20
21
CC_FLAGS = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror \
22
	-Wno-array-bounds -ffunction-sections -fdata-sections -c -iquote$(TOP) \
23
	-include AutoGen.h -I$(INC_DIR) -DSTRING_ARRAY_NAME=«MODULE»Strings -m64 \
24
	-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS \
25
	-mno-red-zone -Wno-address -mcmodel=large -Wno-address \
26
	-Wno-unused-but-set-variable
27
DLINK_FLAGS=-nostdlib -n -q --gc-sections --entry $(IMAGE_ENTRY_POINT) \
28
	-u $(IMAGE_ENTRY_POINT) -melf_x86_64 --oformat=elf64-x86-64 -L $(LIB_DIR) \
29
	--script=$(EFI_LDS) --defsym=PECOFF_HEADER_SIZE=«PECOFF_HEADER_SIZE»
30
«OBJCOPY_FLAGS»
31
«GENFW_FLAGS»
32
33
all:	$(EXEC)
34
35
%.efi:	$(OBJ)
36
	$(DLINK) -o $(@:.efi=.dll) $(DLINK_FLAGS) \
37
		--start-group $(STATIC_LIBRARY_FILES) $^ --end-group
38
	$(OBJCOPY) $(OBJCOPY_FLAGS) $(@:.efi=.dll)
39
	$(CP) $(@:.efi=.dll) $(@:.efi=.debug)
40
	$(OBJCOPY) --strip-unneeded -R .eh_frame $(@:.efi=.dll)
41
	$(OBJCOPY) --add-gnu-debuglink=$(@:.efi=.debug) $(@:.efi=.dll)
42
	$(GENFW) -e $(MODULE_TYPE) -o $@ $(@:.efi=.dll) $(GENFW_FLAGS)
43
	$(RM) $(@:.efi=.dll)
44
45
%.o:	%.c
46
	$(CC) $(CC_FLAGS) -o $@ $^
47
48
clean:
49
	$(RM) *.o
50
51
mrproper: clean
52
	$(RM) $(EXEC) $(EXEC:.efi=.debug)
53
54
.PHONY: all clean mrproper
55
(-)a/sys-boot/udk/files/2015-tools_def.template (+43 lines)
Line 0 Link Here
1
2
#################
3
# My custom toolchain
4
#################
5
*_CUSTOM_*_*_FAMILY          = GCC
6
*_CUSTOM_*_MAKE_PATH         = make
7
*_CUSTOM_*_ASL_PATH          = DEF(UNIX_IASL_BIN)
8
*_CUSTOM_*_OBJCOPY_PATH      = «OBJCOPY»
9
*_CUSTOM_*_CC_PATH           = «CC»
10
*_CUSTOM_*_SLINK_PATH        = «AR»
11
*_CUSTOM_*_DLINK_PATH        = «LD»
12
*_CUSTOM_*_ASLDLINK_PATH     = «LD»
13
*_CUSTOM_*_ASM_PATH          = «CC»
14
*_CUSTOM_*_PP_PATH           = «CC»
15
*_CUSTOM_*_VFRPP_PATH        = «CC»
16
*_CUSTOM_*_ASLCC_PATH        = «CC»
17
*_CUSTOM_*_ASLPP_PATH        = «CC»
18
*_CUSTOM_*_RC_PATH           = «OBJCOPY»
19
*_CUSTOM_*_PP_FLAGS          = DEF(GCC_PP_FLAGS)
20
*_CUSTOM_*_ASLPP_FLAGS       = DEF(GCC_ASLPP_FLAGS)
21
*_CUSTOM_*_ASLCC_FLAGS       = DEF(GCC_ASLCC_FLAGS)
22
*_CUSTOM_*_VFRPP_FLAGS       = DEF(GCC_VFRPP_FLAGS)
23
*_CUSTOM_*_APP_FLAGS         =
24
*_CUSTOM_*_ASL_FLAGS         = DEF(IASL_FLAGS)
25
*_CUSTOM_*_ASL_OUTFLAGS      = DEF(IASL_OUTFLAGS)
26
*_CUSTOM_*_OBJCOPY_FLAGS     =
27
*_CUSTOM_IA32_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS) -m32
28
*_CUSTOM_IA32_ASM_FLAGS      = DEF(GCC_ASM_FLAGS) -m32 -march=i386
29
*_CUSTOM_IA32_CC_FLAGS       = «CFLAGS» -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings -D EFI32
30
*_CUSTOM_IA32_ASLDLINK_FLAGS = -nostdlib -n -q --gc-sections -z common-page-size=0x40 --entry ReferenceAcpiTable -u ReferenceAcpiTable -m elf_i386
31
*_CUSTOM_IA32_DLINK_FLAGS    = -nostdlib -n -q --gc-sections -z common-page-size=0x40 --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map -m elf_i386 --oformat=elf32-i386
32
*_CUSTOM_IA32_DLINK2_FLAGS   = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x220
33
*_CUSTOM_IA32_RC_FLAGS       = DEF(GCC_IA32_RC_FLAGS)
34
*_CUSTOM_IA32_NASM_FLAGS     = -f elf32
35
*_CUSTOM_X64_ASLCC_FLAGS     = DEF(GCC_ASLCC_FLAGS) -m64
36
*_CUSTOM_X64_ASM_FLAGS       = DEF(GCC_ASM_FLAGS) -m64
37
*_CUSTOM_X64_CC_FLAGS        = «CFLAGS» -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS
38
*_CUSTOM_X64_ASLDLINK_FLAGS  = -nostdlib -n -q --gc-sections -z common-page-size=0x40 --entry ReferenceAcpiTable -u ReferenceAcpiTable -m elf_x86_64
39
*_CUSTOM_X64_DLINK_FLAGS     = -nostdlib -n -q --gc-sections -z common-page-size=0x40 --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map -m elf_x86_64 --oformat=elf64-x86-64
40
*_CUSTOM_X64_DLINK2_FLAGS    = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x228
41
*_CUSTOM_X64_RC_FLAGS        = DEF(GCC_X64_RC_FLAGS)
42
*_CUSTOM_X64_NASM_FLAGS      = -f elf64
43
(-)a/sys-boot/udk/metadata.xml (+20 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="doc">Install EDK2 documentation.</flag>
14
    <flag name="examples">Install usage examples.</flag>
15
  </use>
16
  <use lang="fr">
17
    <flag name="doc">Installe la documentation EDK2.</flag>
18
    <flag name="examples">Installe les exemples d'utilisation.</flag>
19
  </use>
20
</pkgmetadata>
(-)a/sys-boot/udk/udk-2015.ebuild (-1 / +241 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 flag-o-matic multiprocessing python-single-r1 toolchain-funcs 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="doc examples"
21
22
DEPEND="app-arch/unzip
23
	dev-lang/nasm
24
	${PYTHON_DEPS}"
25
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
26
27
S="${WORKDIR}/MyWorkSpace"
28
29
pkg_setup() {
30
	UNAME_ARCH=$(uname -m | sed -e 's:i[3456789]86:IA32:')
31
	if [[ ${UNAME_ARCH} == "x86_64" ]] || [[ ${UNAME_ARCH} == "amd64" ]] ; then
32
		export ARCH=X64
33
	else
34
		export ARCH=${UNAME_ARCH}
35
	fi
36
37
	# We will create a custom toolchain with user defined settings
38
	export TOOLCHAIN_TAG="CUSTOM"
39
}
40
41
src_unpack() {
42
	unpack ${A}
43
	unpack "${WORKDIR}/${MY_V}.MyWorkSpace.zip"
44
45
	pushd "${S}" || die
46
	unpack "${WORKDIR}/BaseTools(Unix).tar"
47
48
	local doc_name
49
	if use doc; then
50
		mkdir -p "${S}/doc" || die
51
		pushd "${S}/doc" >/dev/null || die
52
		for f in "${WORKDIR}/Documents/"*" Document.zip"; do
53
			doc_name=$(echo ${f} | sed -e 's:^.*/([^/]*) Document.zip$:\1:')
54
			if [[ -f "${WORKDIR}/Documents/${doc_name} Document.zip" ]]; then
55
				unpack "${WORKDIR}/Documents/${doc_name} Document.zip"
56
				mv "${S}/doc/html" "${S}/doc/${doc_name}" || die
57
			fi
58
		done
59
		popd >/dev/null || die
60
	fi
61
62
	popd >/dev/null || die
63
}
64
65
src_configure() {
66
	python_setup 'python2.7'
67
68
	# Compile of Base Tools is required for further setting up the environment
69
	# Base tools does not like parallel make
70
	local cflags_save=${CFLAGS}
71
	append-cflags $(test-flags-CC -MD) $(test-flags-CC -fshort-wchar)
72
	append-cflags $(test-flags-CC -fno-strict-aliasing)
73
	append-cflags $(test-flags-CC -nostdlib) $(test-flags-CC -c)
74
	sed -e "s:^\(CFLAGS\s*=\).*$:\1 ${CFLAGS}:" \
75
		-i "${S}/BaseTools/Source/C/Makefiles/header.makefile" \
76
		|| die "Failed to update makefile header"
77
	local make_flags=(
78
		CC="$(tc-getCC)"
79
		CXX="$(tc-getCXX)"
80
		AS="$(tc-getAS)"
81
		AR="$(tc-getAR)"
82
		LD="$(tc-getLD)"
83
	)
84
	emake "${make_flags[@]}" -j1 -C BaseTools
85
	. edksetup.sh BaseTools
86
87
	# Update flags in UDK parameter files
88
	CFLAGS=${cflags_save}
89
	append-cflags $(test-flags-CC -fshort-wchar)
90
	append-cflags $(test-flags-CC -fno-strict-aliasing) $(test-flags-CC -c)
91
	append-cflags $(test-flags-CC -ffunction-sections)
92
	append-cflags $(test-flags-CC -fdata-sections)
93
	append-cflags $(test-flags-CC -fno-stack-protector)
94
	append-cflags $(test-flags-CC -fno-asynchronous-unwind-tables)
95
	if [[ "${ARCH}" == "X64" ]]; then
96
		append-cflags $(test-flags-CC -m64) $(test-flags-CC -mno-red-zone)
97
		append-cflags $(test-flags-CC -mcmodel=large)
98
	else
99
		append-cflags $(test-flags-CC -m32) $(test-flags-CC -malign-double)
100
	fi
101
	sed -e "s:^\(ACTIVE_PLATFORM\s*=\).*$:\1 MdeModulePkg/MdeModulePkg.dsc:" \
102
		-e "s:^\(TARGET\s*=\).*$:\1 RELEASE:" \
103
		-e "s:^\(TARGET_ARCH\s*=\).*$:\1 ${ARCH}:" \
104
		-e "s:^\(TOOL_CHAIN_TAG\s*=\).*$:\1 ${TOOLCHAIN_TAG}:" \
105
		-e "s:^\(MAX_CONCURRENT_THREAD_NUMBER\s*=\).*$:\1 $(makeopts_jobs):" \
106
		-i "${S}/Conf/target.txt" || die "Failed to configure target file"
107
	sed -e "s:«CC»:$(tc-getCC):" \
108
		-e "s:«AR»:$(tc-getAR):" \
109
		-e "s:«LD»:$(tc-getLD):" \
110
		-e "s:«OBJCOPY»:$(tc-getOBJCOPY):" \
111
		-e "s:«CFLAGS»:${CFLAGS}:" \
112
		"${FILESDIR}/${PV}-tools_def.template" >>${S}/Conf/tools_def.txt \
113
		|| die "Failed to prepare tools definition file"
114
}
115
116
src_compile() {
117
	local build_target
118
	if use examples; then
119
		build_target=all
120
	else
121
		build_target=libraries
122
	fi
123
124
	build ${build_target} || die "Failed to compile environment"
125
}
126
127
src_install() {
128
	local build_dir="${S}/Build/MdeModule/RELEASE_${TOOLCHAIN_TAG}/${ARCH}"
129
130
	for f in "${build_dir}"/*/Library/*/*/OUTPUT/*.lib; do
131
		newlib.a "${f}" lib$(basename "${f}" .lib).a
132
	done
133
	dolib "${S}/BaseTools/Scripts/GccBase.lds"
134
135
	local include_dest="/usr/include/${PN}"
136
	for f in "" /Guid /IndustryStandard /Library /Pi /Ppi /Protocol /Uefi; do
137
		insinto "${include_dest}${f}"
138
		doins "${S}/MdePkg/Include${f}"/*.h
139
	done
140
	insinto "${include_dest}"
141
	doins "${S}/MdePkg/Include/${ARCH}"/*.h
142
	find "${S}" -name 'BaseTools' -prune -o -name 'MdePkg' -prune -o \
143
		-name 'CryptoPkg' -prune -o -type d -name Include \
144
		-exec find {} -maxdepth 0 \; \
145
		| while read hfile; do
146
		doins -r "${hfile}"/*
147
	done
148
149
	dobin "${S}/BaseTools/Source/C/bin/GenFw"
150
151
	if use doc; then
152
		docinto "html"
153
		# Document installation may be very long, so split it and display message
154
		for f in "${S}"/doc/*; do
155
			ebegin "Installing documentation for $(basename ${f}), please wait"
156
			dodoc -r "${f}"
157
			eend $?
158
		done
159
	fi
160
161
	local ex_rebuild_dir
162
	local ex_name
163
	local ex_build_dir
164
	if use examples; then
165
		ex_rebuild_dir="${S}/${P}-exemples"
166
		for f in "${S}/MdeModulePkg/Application"/*; do
167
			ex_name=$(basename "${f}")
168
			ebegin "Preparing ${ex_name} example"
169
			mkdir -p "${ex_rebuild_dir}/${ex_name}" || die
170
			ex_build_dir="${build_dir}/MdeModulePkg/Application"
171
			ex_build_dir="${ex_build_dir}/${ex_name}/${ex_name}"
172
173
			copySourceFiles "${f}" "${ex_rebuild_dir}/${ex_name}"
174
			copySourceFiles "${ex_build_dir}/DEBUG" "${ex_rebuild_dir}/${ex_name}"
175
			createMakefile "${ex_rebuild_dir}/${ex_name}/Makefile" \
176
				"${ex_name}" "${ex_build_dir}/GNUmakefile" || die
177
178
			tar -C "${ex_rebuild_dir}" -cf "${ex_rebuild_dir}/${ex_name}.tar" \
179
				"${ex_name}" || die
180
181
			eend $? "Failed to create example file"
182
		done
183
		docinto "examples"
184
		dodoc "${ex_rebuild_dir}"/*.tar
185
	fi
186
187
# TODO * QA Notice: The following files contain writable and executable sections
188
# TODO * !WX --- --- usr/lib64/libBaseLib.a:Thunk16.obj
189
# TODO * !WX --- --- usr/lib64/libBaseLib.a:SwitchStack.obj
190
# TODO * !WX --- --- usr/lib64/libBaseLib.a:SetJump.obj
191
# TODO * !WX --- --- usr/lib64/libBaseLib.a:LongJump.obj
192
# TODO * !WX --- --- usr/lib64/libBaseLib.a:EnableDisableInterrupts.obj
193
# TODO * !WX --- --- usr/lib64/libBaseLib.a:DisablePaging64.obj
194
# TODO * !WX --- --- usr/lib64/libBaseLib.a:CpuId.obj
195
# TODO * !WX --- --- usr/lib64/libBaseLib.a:CpuIdEx.obj
196
# TODO * !WX --- --- usr/lib64/libBaseLib.a:EnableCache.obj
197
# TODO * !WX --- --- usr/lib64/libBaseLib.a:DisableCache.obj
198
# TODO * QA Notice: Package triggers severe warnings which indicate that it
199
# TODO *            may exhibit random runtime failures.
200
# 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
201
}
202
203
##
204
# Parameters :
205
# 1 - Path where to search for source files.
206
# 2 - Path where source files must be copied.
207
copySourceFiles() {
208
	while read -d '' -r filename; do
209
		DEST_FILE="${2}${filename#${1}}"
210
		mkdir -p $(dirname "${DEST_FILE}") || die
211
		mv "${filename}" "${DEST_FILE}" || die
212
	done < <(find "${1}" -name '*.h' -print0 -o -name '*.c' -print0)
213
}
214
215
##
216
# Parameters :
217
# 1 - Path of the file to create.
218
# 2 - Name of the module.
219
# 3 - Path of the generated Makefile.
220
createMakefile() {
221
	local static_libs=$(sed -n '/^STATIC_LIBRARY_FILES\s*=/,/^\s*\$(OUTPUT_DIR)/{/^\s*\$(OUTPUT_DIR)/b;p}' ${3} \
222
		| sed -e 's:^\s*\$(BIN_DIR).*/\([^/]*\)\.lib:\t-l\1:' -e 's:\\$:\\\\\\n:' | tr --delete '\n')
223
	local pecoff_header_size;
224
	[[ $ARCH == X64 ]] && pecoff_header_size='0x228' || pecoff_header_size='0x220'
225
	sed -e "s:«MODULE»:${2}:" \
226
		-e "s:«PACKAGE_NAME»:${PN}:" \
227
		-e "s:«STATIC_LIBS»:${static_libs}:" \
228
		-e "s:«MODULE_TYPE»:$(grep -e '^MODULE_TYPE\s*=' ${3} | tail -1):" \
229
		-e "s:«IMAGE_ENTRY_POINT»:$(grep -e '^IMAGE_ENTRY_POINT\s*=' ${3}):" \
230
		-e "s:«CP»:$(grep -e '^CP\s*=' ${3}):" \
231
		-e "s:«RM»:$(grep -e '^RM\s*=' ${3}):" \
232
		-e "s:«CC»:$(grep -e '^CC\s*=' ${3}):" \
233
		-e "s:«DLINK»:$(grep -e '^DLINK\s*=' ${3}):" \
234
		-e "s:«OBJCOPY»:$(grep -e '^OBJCOPY\s*=' ${3}):" \
235
		-e "s:«GENFW»:$(grep -e '^GENFW\s*=' ${3}):" \
236
		-e "s:«PECOFF_HEADER_SIZE»:${pecoff_header_size}:" \
237
		-e "s:«OBJCOPY_FLAGS»:$(grep -e '^OBJCOPY_FLAGS\s*=' ${3}):" \
238
		-e "s:«GENFW_FLAGS»:$(grep -e '^GENFW_FLAGS\s*=' ${3}):" \
239
		"${FILESDIR}/${PV}-makefile.template" >${1} \
240
		|| die "Failed to create Makefile"
241
}

Return to bug 588440