diff options
Diffstat (limited to 'sys-boot')
-rw-r--r-- | sys-boot/Manifest.gz | bin | 7216 -> 7215 bytes | |||
-rw-r--r-- | sys-boot/grub/Manifest | 2 | ||||
-rw-r--r-- | sys-boot/grub/grub-2.04_rc1.ebuild | 3 | ||||
-rw-r--r-- | sys-boot/udk/Manifest | 6 | ||||
-rw-r--r-- | sys-boot/udk/files/2018-makefile.template | 41 | ||||
-rw-r--r-- | sys-boot/udk/udk-2015-r1.ebuild (renamed from sys-boot/udk/udk-2015.ebuild) | 124 | ||||
-rw-r--r-- | sys-boot/udk/udk-2018.ebuild | 212 |
7 files changed, 300 insertions, 88 deletions
diff --git a/sys-boot/Manifest.gz b/sys-boot/Manifest.gz Binary files differindex 62376ba7defb..f4613a72274c 100644 --- a/sys-boot/Manifest.gz +++ b/sys-boot/Manifest.gz diff --git a/sys-boot/grub/Manifest b/sys-boot/grub/Manifest index e837f78c364f..9dcf1a0c1efb 100644 --- a/sys-boot/grub/Manifest +++ b/sys-boot/grub/Manifest @@ -13,6 +13,6 @@ DIST grub-2.04~rc1.tar.xz 6422420 BLAKE2B cf189fea32badba00051734d4e67954009bae0 DIST unifont-12.0.01.pcf.gz 1360857 BLAKE2B ab87e58aee2295e52dc49b7bb131793ad775abbf49f4b64758045a9b5158e75afd01a8425b56e6f6d0ba288a733bf426df363c1ecc78daddec516c33d461bc3b SHA512 9d34a005dd10f212e43075beb71eb39b9cc3403ae1cddec7d79af91b3a3a1beb4a3696075cc94563c8402efe2ad05de552ace77a24da09f1c0b7f95e99b056a3 DIST unifont-9.0.06.pcf.gz 1360354 BLAKE2B 09b96e1711c729ef159d62e3ea7b289ca2d01dc0ea417e35a18b73dc02a23f62ce7821d9761bceee4002d9eeaabd91cfb69bbacc6fbdfdfa00445d18fe8f1d66 SHA512 dd0a1afa72f5204c62055d83f22750c74af38ffafdb8eda8e1f1cf7292e572a14969b8a9a6a2cb336d5bed4ab633f6b5a962c59117a590e4238788959cb82774 EBUILD grub-2.02-r3.ebuild 7983 BLAKE2B 68cafd89dafd6c623422e47012643f68ea20b66c5f87817625a34a5a019c62079e1832ef34fc2eb78c308543bd082cd9662f3002ddd6041a49bb4e88761b5058 SHA512 79a1463b4a47efc00b8ba73a1876f12cdca5ca3cfc7a4711044c310eddb24484b2603ba131ed598dac96b4a3e94b2f36cc0b9288b2998dd936433cf1a615ed23 -EBUILD grub-2.04_rc1.ebuild 7776 BLAKE2B b1463eb677b030af63b3191983ce2dbe19e0318b4139eb1652c7992aab0e53a3ade17383b03452ee748364192cd40d656f52fe60e22daf96a95994fd3d9bd128 SHA512 7e71680b2b23865450d051b1c424d3dec9dbfd1eea3b0b01ec0fc5470f453e1f4dab771ecbcf3194c2bb7dceb4ed5f880bb54315b71b11f5d75094b9b42dbe3d +EBUILD grub-2.04_rc1.ebuild 7764 BLAKE2B e10ed35013b2432695b780b6ab59c0f8338b6d3a1eb78eb9cc54de3ab82ed562d7d5d6221477ebf48af293b13c7b82deb64e0617d4bc31c17f8000816020eef6 SHA512 d73f8f8ea009c67d50daa57461a7cf0fbb90e693a0bd2585ca85b4fb73ef619d69c9c814c55cbd8db79424e5bbc87022568ae5d8df99f740dad9761fdd6cc483 EBUILD grub-9999.ebuild 7764 BLAKE2B e10ed35013b2432695b780b6ab59c0f8338b6d3a1eb78eb9cc54de3ab82ed562d7d5d6221477ebf48af293b13c7b82deb64e0617d4bc31c17f8000816020eef6 SHA512 d73f8f8ea009c67d50daa57461a7cf0fbb90e693a0bd2585ca85b4fb73ef619d69c9c814c55cbd8db79424e5bbc87022568ae5d8df99f740dad9761fdd6cc483 MISC metadata.xml 1149 BLAKE2B c0a364b1d8139f26f7dd09ba49dd68d591c7532e2eec25dae97caea49be8bfc92c8d5c69dcc77d89f58367fa04a73526cc55768f93222effc6c6e47a52b53500 SHA512 45d0425236957395e275bd340aeabfcd03451b037c616c54cf8babdc3bdee6aa3706fa7565f595ba4391773d331353b8920a627094c01289935a1a9aedc1f7bf diff --git a/sys-boot/grub/grub-2.04_rc1.ebuild b/sys-boot/grub/grub-2.04_rc1.ebuild index 4c20d004b21d..38c9444f69aa 100644 --- a/sys-boot/grub/grub-2.04_rc1.ebuild +++ b/sys-boot/grub/grub-2.04_rc1.ebuild @@ -1,7 +1,7 @@ # Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=6 +EAPI=7 if [[ ${PV} == 9999 ]]; then GRUB_AUTORECONF=1 @@ -108,7 +108,6 @@ COMMON_DEPEND=" grub_platforms_xen-32? ( app-emulation/xen-tools:= ) " DEPEND="${COMMON_DEPEND} - ${BDEPEND} static? ( app-arch/xz-utils[static-libs(+)] truetype? ( diff --git a/sys-boot/udk/Manifest b/sys-boot/udk/Manifest index 78dcb898d7b3..9cc7ba308e60 100644 --- a/sys-boot/udk/Manifest +++ b/sys-boot/udk/Manifest @@ -1,5 +1,9 @@ AUX 2015-makefile.template 1543 BLAKE2B 6f16a0e3c726a99a30b68cc24f7a85267b1748c4822e1970c498f877d22195989022ddd1e1d2496744b5a8b1dde1d9dc2ebcb7dfe336b01c7258430938d05531 SHA512 c09aca05b07dbd5d2ac1979b98d889e0a2a44e6c12292cca5c6033e1c094acbf155ef1649a7f0b923e3062f4f2fd8f650f57523625628a29828c22ef1f95b405 AUX 2015-tools_def.template 2575 BLAKE2B 9666cb1b6d225eec6e6ca3762b6c5b10332f045035787585805485b9d7ba54a54543855adda8253ecd451674d00c4beaf153a94dd3ff4c8b5ab1fa5b72d92610 SHA512 7bf9e23434ec6e4abaf525a857719d5ddf3c355a4dd2f2f6666db62cfb9b9f981180a4886d9e98f43b82b2b4a397a862201ded196ed12726b2f813d5a61bbc86 +AUX 2018-makefile.template 1059 BLAKE2B 6dda7de8a85fc2d8a55078ee298d622618da72f486a3453193dd0c0f5db1494433af6295909dbeb357aa967b58f640820d2f4790a4bec9304db0ce6e49ba2fb4 SHA512 527242cb30b23c3f2f9d6409f28d02bc41367e5cf15484819d0d8eb894b10252c0fedd4f0b11e8b5383216584846495946aad22a5ed7d25ddde511701e13b0cd DIST UDK2015.Complete.MyWorkSpace.zip 121736982 BLAKE2B b37bd9ead6ce2c665128199249483ecbcb0f410077d0ca61820bdccb7ae71f6dad870a3cf2dad79f997ad9114678fab3c15a17227ae33aa1ff66f9187aa3a568 SHA512 7856a8f29296f817e8fd09d8eaf7207f4e25a13faa10936d1ceb10cb6a900be265379722c0ade0ef93b1c640fef8693667d2567962e3288b20ae77f607f03d39 -EBUILD udk-2015.ebuild 8401 BLAKE2B 895d85de0809ade4725362bea0a1cc82b1bee3cc3195c76cb2a1bc1b18549a18db826443cfa8b0e9caea39f0f92f06c3019369d13ba81546aa0c951e5d54679b SHA512 7cd8fa58cb06e9d9bfbe93c8f2b84a0579706422d12ce3eb970b319b4025f191fb0d2578d70e6d28045d12c8fc12419951b83163e77671ac8ee2e0d355e82a22 +DIST udk-2018-docs.zip 79352781 BLAKE2B 9d08579d4645121cabb7ac52850de6492f9990240da9236064352df0595867bfc6952c9858865a8ce1d81982ec0e2440dc19930a75595454257294462adc60d6 SHA512 6ba2d961f20267cafb94bd020e8fe71e1392f1f2cdbc5c9f0a43212253ddf137b3e12cc789299dfd1ea099bb1541703b995ae20d28f0275395f5f85ed0656954 +DIST udk-2018.tar.gz 38642782 BLAKE2B a10171659451d7d3df737066ec0471db1e5055bd52556d4d0654b244e827512db8d88e2b74b4dfe0189f768e0eab7a705aa32a720e047555995cf339ea50c62f SHA512 8fd9316f08a5c30f8684b2fde73906a943bb067ec91699f41796e27679af73dbc38efaa100a57d4b835656b402d9c08896abc5c10fd0d607a7e0173b3d7a60b2 +EBUILD udk-2015-r1.ebuild 6463 BLAKE2B 9d2d5d482c35424338626729380a231fc080e48a309c80c128b87b64fd7206cc594b1f7e2a20a1ca5a8015cd267916629b18454a5564c3ba5ca2636c5f21b04d SHA512 868d1c3fb22683772fea293d1dc4961438dde5f6df247b6895fc5709291283c1807fcd15f4d8c557a28ee3cb98e1501476c159574fed0bd2549e0e4ad88aae75 +EBUILD udk-2018.ebuild 6564 BLAKE2B 627ae99e97b02669348217286cc0345b3e0bfcc6ebab6f33d822742ff64cd704c0b87db82077d39eff3e3b978c8653665a167d7bfe5ec0d9474536c38e92f6ee SHA512 db785921a62a5cd0d4089114a3b1a9ad678c4ba6eadf099eaeed4888bae9cf1e77354458ca279ffbc15aaa9ce73490602fa18af4457dfd5594ddcd7960f6327f MISC metadata.xml 721 BLAKE2B 863e21fdb7ac310469efdddbbbff0f1b23aa8b6cb6cdb27d6bfa1b024e795ef3b86e72d9dd7b6bca8a5326755615710bc0a59a6f4e3b53149490402d10c24d42 SHA512 20ac00286729ab06e607513002f2bcfe75866108914015d11a3139f95073b393c62046832fd3295f4e849a5cc810b996f0ca8b589cc6639e726563110e1c60fe 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-2015.ebuild b/sys-boot/udk/udk-2015-r1.ebuild index 877b99c94eb1..fbb8ad18187d 100644 --- a/sys-boot/udk/udk-2015.ebuild +++ b/sys-boot/udk/udk-2015-r1.ebuild @@ -1,14 +1,14 @@ -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=6 +EAPI=7 PYTHON_COMPAT=( python2_7 ) PYTHON_REQ_USE="sqlite" -inherit flag-o-matic multiprocessing python-single-r1 toolchain-funcs versionator +inherit flag-o-matic multiprocessing python-single-r1 toolchain-funcs -MY_V="${PN^^}$(get_version_component_range 1)" +MY_V="${PN^^}${PV}" DESCRIPTION="Tianocore UEFI Development kit" HOMEPAGE=" https://github.com/tianocore/tianocore.github.io/wiki/EDK-II" @@ -19,6 +19,7 @@ SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="doc examples" REQUIRED_USE="${PYTHON_REQUIRED_USE}" +RESTRICT="strip" RDEPEND="${PYTHON_DEPS}" DEPEND="${RDEPEND} @@ -27,18 +28,20 @@ DEPEND="${RDEPEND} S="${WORKDIR}/MyWorkSpace" +# Generated libs for EFI can contain WX sections +QA_EXECSTACK="usr/lib*/libBaseLib.a:*" + pkg_setup() { python_setup 'python2.7' - local uname_arch=$(uname -m | sed -e 's:i[3456789]86:IA32:') - if [[ ${uname_arch} == "x86_64" ]] || [[ ${uname_arch} == "amd64" ]] ; then - export ARCH=X64 - else - export ARCH=${uname_arch} + if [[ ${ARCH} == "amd64" ]]; then + ARCH=X64 + elif [[ ${ARCH} == "x86" ]]; then + ARCH=IA32 fi # We will create a custom toolchain with user defined settings - export TOOLCHAIN_TAG="CUSTOM" + TOOLCHAIN_TAG="CUSTOM" } src_unpack() { @@ -54,10 +57,11 @@ src_unpack() { mkdir -p "${S}/doc" || die pushd "${S}/doc" >/dev/null || die for f in "${WORKDIR}/Documents/"*" Document.zip"; do - doc_name=$(echo ${f} | sed -e 's:^.*/\([^/]*\) Document[.]zip$:\1:') + doc_name=${f##*/} + doc_name=${doc_name% Document.zip} if [[ -f "${WORKDIR}/Documents/${doc_name} Document.zip" ]]; then unpack "${WORKDIR}/Documents/${doc_name} Document.zip" - mv "${S}/doc/html" "${S}/doc/${doc_name}" || die + mv "html" "${doc_name}" || die fi done popd >/dev/null || die @@ -67,14 +71,16 @@ src_unpack() { } src_configure() { + # Patch source file for permissive error (issue #639080) + sed -e "s/\(mStringFileName == \)'\\\\0'/\1NULL/" \ + -i "${S}/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp" \ + || die "Failed to patch source file" + sed -e "s/\((StringPtr != \)L'\\\\0'/\1NULL/" \ + -i "${S}/MdeModulePkg/Library/UefiHiiLib/HiiLib.c" \ + || die "Failed to patch source file" # Compile of Base Tools is required for further setting up the environment # Base tools does not like parallel make - local cflags_save=${CFLAGS} - append-cflags $(test-flags-CC -MD) $(test-flags-CC -fshort-wchar) - append-cflags $(test-flags-CC -fno-strict-aliasing) - append-cflags $(test-flags-CC -nostdlib) $(test-flags-CC -c) - append-cflags $(test-flags-CC -fPIC) - sed -e "s:^\(CFLAGS\s*=\).*$:\1 ${CFLAGS}:" \ + sed -e "s:^\(CFLAGS\s*=\).*$:\1 ${CFLAGS} -MD -fshort-wchar -fno-strict-aliasing -nostdlib -c -fPIC:" \ -i "${S}/BaseTools/Source/C/Makefiles/header.makefile" \ || die "Failed to update makefile header" local make_flags=( @@ -88,9 +94,7 @@ src_configure() { . edksetup.sh BaseTools # Update flags in UDK parameter files - CFLAGS=${cflags_save} - append-cflags $(test-flags-CC -fshort-wchar) - append-cflags $(test-flags-CC -fno-strict-aliasing) $(test-flags-CC -c) + append-cflags -fshort-wchar -fno-strict-aliasing -c append-cflags $(test-flags-CC -ffunction-sections) append-cflags $(test-flags-CC -fdata-sections) append-cflags $(test-flags-CC -fno-stack-protector) @@ -117,14 +121,12 @@ src_configure() { } src_compile() { - local build_target if use examples; then - build_target=all - else - build_target=libraries + ewarn "Examples installation does not work anymore" + ewarn "Try with a most recent version of the package" fi - build ${build_target} || die "Failed to compile environment" + build libraries || die "Failed to compile environment" } src_install() { @@ -132,24 +134,19 @@ src_install() { local build_dir="${S}/Build/MdeModule/RELEASE_${TOOLCHAIN_TAG}/${ARCH}" for f in "${build_dir}"/*/Library/*/*/OUTPUT/*.lib; do - newlib.a "${f}" lib$(basename "${f}" .lib).a + local fn="lib${f##*/}" + newlib.a "${f}" "${fn%.lib}.a" done - dolib "${S}/BaseTools/Scripts/GccBase.lds" + dolib.a "${S}/BaseTools/Scripts/GccBase.lds" - local include_dest="/usr/include/${PN}" - for f in "" /Guid /IndustryStandard /Library /Pi /Ppi /Protocol /Uefi; do - insinto "${include_dest}${f}" - doins "${S}/MdePkg/Include${f}"/*.h - done - insinto "${include_dest}" - doins "${S}/MdePkg/Include/${ARCH}"/*.h + insinto "/usr/include/${PN}" + doins "${S}/MdePkg/Include/"*.h + doins -r "${S}/MdePkg/Include/"{${ARCH}/.,Guid,IndustryStandard,Library,Pi,Ppi,Protocol,Uefi} local hfile - find "${S}" -name 'BaseTools' -prune -o -name 'MdePkg' -prune -o \ - -name 'CryptoPkg' -prune -o -type d -name Include \ - -exec find {} -maxdepth 0 \; \ - | while read hfile; do - doins -r "${hfile}"/* - done + 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" @@ -157,52 +154,11 @@ src_install() { docinto "html" # Document installation may be very long, so split it and display message for f in "${S}"/doc/*; do - ebegin "Installing documentation for $(basename ${f}), please wait" + ebegin "Install documentation for ${f##*/}" dodoc -r "${f}" eend $? done fi - - 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=$(basename "${f}") - ebegin "Preparing ${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 $? "Failed to create example file" - done - docinto "examples" - dodoc "${ex_rebuild_dir}"/*.tar - fi - -# TODO * QA Notice: The following files contain writable and executable sections -# TODO * !WX --- --- usr/lib64/libBaseLib.a:Thunk16.obj -# TODO * !WX --- --- usr/lib64/libBaseLib.a:SwitchStack.obj -# TODO * !WX --- --- usr/lib64/libBaseLib.a:SetJump.obj -# TODO * !WX --- --- usr/lib64/libBaseLib.a:LongJump.obj -# TODO * !WX --- --- usr/lib64/libBaseLib.a:EnableDisableInterrupts.obj -# TODO * !WX --- --- usr/lib64/libBaseLib.a:DisablePaging64.obj -# TODO * !WX --- --- usr/lib64/libBaseLib.a:CpuId.obj -# TODO * !WX --- --- usr/lib64/libBaseLib.a:CpuIdEx.obj -# TODO * !WX --- --- usr/lib64/libBaseLib.a:EnableCache.obj -# TODO * !WX --- --- usr/lib64/libBaseLib.a:DisableCache.obj -# TODO * QA Notice: Package triggers severe warnings which indicate that it -# TODO * may exhibit random runtime failures. -# 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 } ## @@ -213,7 +169,7 @@ copySourceFiles() { local dest_file while read -d '' -r filename; do dest_file="${2}${filename#${1}}" - mkdir -p $(dirname "${dest_file}") || die + mkdir -p "${dest_file%/*}" || die mv "${filename}" "${dest_file}" || die done < <(find "${1}" -name '*.h' -print0 -o -name '*.c' -print0) } 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" +} |