diff options
author | Stéphane Veyret <sveyret@gmail.com> | 2019-04-10 17:29:29 +0200 |
---|---|---|
committer | Georgy Yakovlev <gyakovlev@gentoo.org> | 2019-05-01 14:41:27 -0700 |
commit | b1193c44d34f7af290c04f4aaf8df0781c1c9836 (patch) | |
tree | dff98c45862daf165dd58b5ebe68266e0cdfeae7 /sys-boot | |
parent | sys-boot/udk: Correct issues with latest compiler versions (diff) | |
download | gentoo-b1193c44d34f7af290c04f4aaf8df0781c1c9836.tar.gz gentoo-b1193c44d34f7af290c04f4aaf8df0781c1c9836.tar.bz2 gentoo-b1193c44d34f7af290c04f4aaf8df0781c1c9836.zip |
sys-boot/udk: Bump to version 2018
Signed-off-by: Stéphane VEYRET <sveyret@gmail.com>
Closes: https://bugs.gentoo.org/628300
Bug: https://bugs.gentoo.org/603986
Bug: https://bugs.gentoo.org/598042
Package-Manager: Portage-2.3.62, Repoman-2.3.11
Closes: https://github.com/gentoo/gentoo/pull/11655
Reviewed-by: Michał Górny <mgorny@gentoo.org>
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'sys-boot')
-rw-r--r-- | sys-boot/udk/Manifest | 2 | ||||
-rw-r--r-- | sys-boot/udk/files/2018-makefile.template | 41 | ||||
-rw-r--r-- | sys-boot/udk/udk-2018.ebuild | 212 |
3 files changed, 255 insertions, 0 deletions
diff --git a/sys-boot/udk/Manifest b/sys-boot/udk/Manifest index e8605e43db6e..5b45c5e5d81f 100644 --- a/sys-boot/udk/Manifest +++ b/sys-boot/udk/Manifest @@ -1 +1,3 @@ DIST UDK2015.Complete.MyWorkSpace.zip 121736982 BLAKE2B b37bd9ead6ce2c665128199249483ecbcb0f410077d0ca61820bdccb7ae71f6dad870a3cf2dad79f997ad9114678fab3c15a17227ae33aa1ff66f9187aa3a568 SHA512 7856a8f29296f817e8fd09d8eaf7207f4e25a13faa10936d1ceb10cb6a900be265379722c0ade0ef93b1c640fef8693667d2567962e3288b20ae77f607f03d39 +DIST udk-2018-docs.zip 79352781 BLAKE2B 9d08579d4645121cabb7ac52850de6492f9990240da9236064352df0595867bfc6952c9858865a8ce1d81982ec0e2440dc19930a75595454257294462adc60d6 SHA512 6ba2d961f20267cafb94bd020e8fe71e1392f1f2cdbc5c9f0a43212253ddf137b3e12cc789299dfd1ea099bb1541703b995ae20d28f0275395f5f85ed0656954 +DIST udk-2018.tar.gz 38642782 BLAKE2B a10171659451d7d3df737066ec0471db1e5055bd52556d4d0654b244e827512db8d88e2b74b4dfe0189f768e0eab7a705aa32a720e047555995cf339ea50c62f SHA512 8fd9316f08a5c30f8684b2fde73906a943bb067ec91699f41796e27679af73dbc38efaa100a57d4b835656b402d9c08896abc5c10fd0d607a7e0173b3d7a60b2 diff --git a/sys-boot/udk/files/2018-makefile.template b/sys-boot/udk/files/2018-makefile.template new file mode 100644 index 000000000000..049a94facd81 --- /dev/null +++ b/sys-boot/udk/files/2018-makefile.template @@ -0,0 +1,41 @@ +TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +BASE_NAME = «MODULE» +EXEC = «MODULE».efi +SRC = $(shell find $(TOP) -type f -name '*.c') +OBJ = $(SRC:.c=.o) +INC_DIR = /usr/include/«PACKAGE_NAME» +LIB_DIR = «LIB_DIR» +DEST_DIR_DEBUG = . +«STATIC_LIBS» + +EFI_LDS = «EFI_LDS» +«MODULE_TYPE» +«VARIABLES» + +comma:= , +empty:= +space:= $(empty) $(empty) + +all: $(EXEC) + +%.efi: $(OBJ) + $(DLINK) -o $(@:.efi=.dll) $(DLINK_FLAGS) \ + -Wl,--script,$(EFI_LDS) -Wl,--defsym=PECOFF_HEADER_SIZE=«PECOFF_HEADER_SIZE» \ + -Wl,$(subst $(space),$(comma),--start-group $(STATIC_LIBRARY_FILES)$^ --end-group) + $(OBJCOPY) $(OBJCOPY_FLAGS) $(@:.efi=.dll) + $(CP) $(@:.efi=.dll) $(@:.efi=.debug) + $(OBJCOPY) --strip-unneeded -R .eh_frame $(@:.efi=.dll) + $(OBJCOPY) --add-gnu-debuglink=$(@:.efi=.debug) $(@:.efi=.dll) + $(GENFW) -e $(MODULE_TYPE) -o $@ $(@:.efi=.dll) $(GENFW_FLAGS) + $(RM) $(@:.efi=.dll) + +%.o: %.c + $(CC) $(CC_FLAGS) -I$(INC_DIR) -iquote$(TOP) -c -o $@ $^ + +clean: + $(RM) *.o + +mrproper: clean + $(RM) $(EXEC) $(EXEC:.efi=.debug) + +.PHONY: all clean mrproper diff --git a/sys-boot/udk/udk-2018.ebuild b/sys-boot/udk/udk-2018.ebuild new file mode 100644 index 000000000000..d89fdb55e27f --- /dev/null +++ b/sys-boot/udk/udk-2018.ebuild @@ -0,0 +1,212 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python2_7 ) +PYTHON_REQ_USE="sqlite" + +inherit flag-o-matic multiprocessing python-single-r1 toolchain-funcs + +DESCRIPTION="Tianocore UEFI Development kit" +HOMEPAGE="https://github.com/tianocore/tianocore.github.io/wiki/EDK-II" + +if [[ ${PV} == *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/tianocore/edk2.git" + KEYWORDS="" +else + MY_V="${PN^^}${PV}" + SRC_URI="https://github.com/tianocore/edk2/archive/v${MY_V}.tar.gz -> ${P}.tar.gz + doc? ( https://github.com/tianocore/edk2/releases/download/v${MY_V}/${MY_V}.Documents.zip -> ${P}-docs.zip )" + S="${WORKDIR}/edk2-v${MY_V}" + KEYWORDS="~amd64 ~x86" +fi + +LICENSE="BSD-2" +SLOT="0" +IUSE="doc examples" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" +RESTRICT="strip" + +RDEPEND="${PYTHON_DEPS}" +DEPEND="${RDEPEND} + >=dev-lang/nasm-2.14.02 + >=sys-power/iasl-20160729 + doc? ( app-arch/unzip )" + +DOCDIR="${WORKDIR}/Documents" + +# Generated libs for EFI can contain WX sections +QA_EXECSTACK=" + usr/lib*/libBaseLib.a:* + usr/lib*/libBaseIoLibIntrinsic.a:* +" + +pkg_setup() { + if [[ ${ARCH} == "amd64" ]]; then + ARCH=X64 + elif [[ ${ARCH} == "x86" ]]; then + ARCH=IA32 + fi + + # Select toolchain within predefined ones + if tc-is-gcc; then + TOOLCHAIN_TAG="GCC5" + elif tc-is-clang; then + TOOLCHAIN_TAG="CLANG38" + else + TOOLCHAIN_TAG="ELFGCC" + fi +} + +src_unpack() { + default + + local doc_name + local f + if use doc; then + pushd "${DOCDIR}" >/dev/null || die + rm -f *.chm || die + for f in *.zip; do + unpack "${DOCDIR}/${f}" + mv html "${f%.zip}" || die + done + rm -f *.zip || die + popd >/dev/null || die + fi +} + +src_configure() { + # Compile of Base Tools is required for further setting up the environment + # Base tools does not like parallel make + sed -e "s:^\(BUILD_CFLAGS\s*=\).*$:\1 ${CFLAGS} -MD -fshort-wchar -fno-strict-aliasing -nostdlib -c -fPIC:" \ + -i "BaseTools/Source/C/Makefiles/header.makefile" \ + || die "Failed to update makefile header" + local make_flags=( + BUILD_CC="$(tc-getBUILD_CC)" + BUILD_CXX="$(tc-getBUILD_CXX)" + BUILD_AS="$(tc-getBUILD_AS)" + BUILD_AR="$(tc-getBUILD_AR)" + BUILD_LD="$(tc-getBUILD_LD)" + ) + emake "${make_flags[@]}" -j1 -C BaseTools + . edksetup.sh + + # Update UDK parameter files + sed -e "s:^\(ACTIVE_PLATFORM\s*=\).*$:\1 MdeModulePkg/MdeModulePkg.dsc:" \ + -e "s:^\(TARGET\s*=\).*$:\1 RELEASE:" \ + -e "s:^\(TARGET_ARCH\s*=\).*$:\1 ${ARCH}:" \ + -e "s:^\(TOOL_CHAIN_TAG\s*=\).*$:\1 ${TOOLCHAIN_TAG}:" \ + -e "s:^\(MAX_CONCURRENT_THREAD_NUMBER\s*=\).*$:\1 $(makeopts_jobs):" \ + -i "Conf/target.txt" || die "Failed to configure target file" + sed -e "s:\(_\(CC\|ASM\|PP\|VFRPP\|ASLCC\|ASLPP\|DLINK\)_PATH\s*=\).*$:\1 $(tc-getCC):" \ + -e "s:\(_ASLDLINK_PATH\s*=\).*$:\1 $(tc-getLD):" \ + -e "s:\(_OBJCOPY_PATH\s*=\).*$:\1 $(tc-getOBJCOPY):" \ + -e "s:\(_RC_PATH\s*=\).*$:\1 $(tc-getOBJCOPY):" \ + -e "s:\(_SLINK_PATH\s*=\).*$:\1 $(tc-getAR):" \ + -i "Conf/tools_def.txt" \ + || die "Failed to prepare tools definition file" +} + +src_compile() { + build $(usex examples all libraries) || die "Failed to compile environment" + +# TODO * /var/tmp/portage/sys-apps/sandbox-2.10-r1/work/sandbox-2.10/libsandbox/trace.c:_do_ptrace():74: failure (Operation not permitted): +# TODO * ISE:_do_ptrace: ptrace(PTRACE_TRACEME, ..., 0x0000000000000000, 0x0000000000000000): Operation not permitted +} + +src_install() { + local f + local build_dir="${S}/Build/MdeModule/RELEASE_${TOOLCHAIN_TAG}/${ARCH}" + + for f in "${build_dir}"/*/Library/*/*/OUTPUT/*.lib; do + local fn="lib${f##*/}" + newlib.a "${f}" "${fn%.lib}.a" + done + + insinto "/usr/share/${P}" + doins "${S}/BaseTools/Scripts/GccBase.lds" + + insinto "/usr/include/${PN}" + doins "${S}/MdePkg/Include/"*.h + doins -r "${S}/MdePkg/Include/"{${ARCH}/.,Guid,IndustryStandard,Library,Pi,Ppi,Protocol,Uefi} + local hfile + while read -d '' -r hfile; do + doins -r "${hfile}/." + done < <(find "${S}" -name 'BaseTools' -prune -o -name 'MdePkg' -prune -o \ + -name 'CryptoPkg' -prune -o -type d -name Include -print0) + + dobin "${S}/BaseTools/Source/C/bin/GenFw" + + local HTML_DOCS + use doc && HTML_DOCS=( "${DOCDIR}"/. ) + einstalldocs + + local ex_rebuild_dir + local ex_name + local ex_build_dir + if use examples; then + ex_rebuild_dir="${S}/${P}-exemples" + for f in "${S}/MdeModulePkg/Application"/*; do + ex_name="${f##*/}" + ebegin "Install ${ex_name} example" + mkdir -p "${ex_rebuild_dir}/${ex_name}" || die + ex_build_dir="${build_dir}/MdeModulePkg/Application" + ex_build_dir="${ex_build_dir}/${ex_name}/${ex_name}" + + copySourceFiles "${f}" "${ex_rebuild_dir}/${ex_name}" + copySourceFiles "${ex_build_dir}/DEBUG" "${ex_rebuild_dir}/${ex_name}" + createMakefile "${ex_rebuild_dir}/${ex_name}/Makefile" \ + "${ex_name}" "${ex_build_dir}/GNUmakefile" + + tar -C "${ex_rebuild_dir}" -cf "${ex_rebuild_dir}/${ex_name}.tar" \ + "${ex_name}" || die + + eend $? + done + docinto "examples" + dodoc "${ex_rebuild_dir}"/*.tar + fi +} + +## +# Parameters : +# 1 - Path where to search for source files. +# 2 - Path where source files must be copied. +copySourceFiles() { + local dest_file + while read -d '' -r filename; do + dest_file="${2}${filename#${1}}" + mkdir -p "${dest_file%/*}" || die + mv "${filename}" "${dest_file}" || die + done < <(find "${1}" \( -name '*.h' -o -name '*.c' \) -print0) +} + +## +# Parameters : +# 1 - Path of the file to create. +# 2 - Name of the module. +# 3 - Path of the generated Makefile. +createMakefile() { + local static_libs=$(sed -n '/^STATIC_LIBRARY_FILES\s*=/,/^\s*\$(OUTPUT_DIR)/{/^\s*\$(OUTPUT_DIR)/b;p}' ${3} \ + | sed -e 's:^\s*\$(BIN_DIR).*/\([^/]*\)\.lib:\t-l\1:' -e 's:\\$:\\\\\\n:' \ + | tr --delete '\n') + local pecoff_header_size=$(grep -e '--defsym=PECOFF_HEADER_SIZE=' ${3} \ + | sed -e 's/^.*--defsym=PECOFF_HEADER_SIZE=\(\S*\).*$/\1/') + local variables=$(grep -e '^IMAGE_ENTRY_POINT\s*=' -e '^CP\s*=' \ + -e '^RM\s*=' -e '^CC\s*=' -e '^DLINK\s*=' -e '^OBJCOPY\s*=' \ + -e '^GENFW\s*=' -e '^CC_FLAGS\s*=' -e '^DLINK_FLAGS\s*=' \ + -e '^OBJCOPY_FLAGS\s*=' -e '^GENFW_FLAGS\s*=' ${3} \ + | sed -e 's:$:\\n:' | tr --delete '\n') + sed -e "s:«MODULE»:${2}:" \ + -e "s:«PACKAGE_NAME»:${PN}:" \ + -e "s:«LIB_DIR»:$(get_libdir):" \ + -e "s:«EFI_LDS»:/usr/share/${P}/GccBase.lds:" \ + -e "s:«STATIC_LIBS»:${static_libs}:" \ + -e "s:«MODULE_TYPE»:$(grep -e '^MODULE_TYPE\s*=' ${3} | tail -1):" \ + -e "s:«VARIABLES»:${variables}:" \ + -e "s:«PECOFF_HEADER_SIZE»:${pecoff_header_size}:" \ + "${FILESDIR}/${PV}-makefile.template" >${1} \ + || die "Failed to create Makefile" +} |