summaryrefslogtreecommitdiff
path: root/sys-boot/udk
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-boot/udk
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-boot/udk')
-rw-r--r--sys-boot/udk/Manifest6
-rw-r--r--sys-boot/udk/files/2015-makefile.template54
-rw-r--r--sys-boot/udk/files/2015-tools_def.template42
-rw-r--r--sys-boot/udk/metadata.xml23
-rw-r--r--sys-boot/udk/udk-2015.ebuild247
5 files changed, 372 insertions, 0 deletions
diff --git a/sys-boot/udk/Manifest b/sys-boot/udk/Manifest
new file mode 100644
index 000000000000..f2f4052bb6b7
--- /dev/null
+++ b/sys-boot/udk/Manifest
@@ -0,0 +1,6 @@
+AUX 2015-makefile.template 1543 SHA256 4cc009c29bc9008c6ba0aa2736187b99f11e60464111dd78e3ff0bec9a340786 SHA512 c09aca05b07dbd5d2ac1979b98d889e0a2a44e6c12292cca5c6033e1c094acbf155ef1649a7f0b923e3062f4f2fd8f650f57523625628a29828c22ef1f95b405 WHIRLPOOL 6fa49719a477da3feb4d5a9fd9c5d35f0fd964cd914615aa356b97be4da5fcddb2c00d480210d852ac61b3992f158e845182e3571e893a840b70c87cdd698ca2
+AUX 2015-tools_def.template 2575 SHA256 689949a05a2a99c1b6d9bab38667985029f6f7d0a21fa56d8c69ce753dcd769c SHA512 7bf9e23434ec6e4abaf525a857719d5ddf3c355a4dd2f2f6666db62cfb9b9f981180a4886d9e98f43b82b2b4a397a862201ded196ed12726b2f813d5a61bbc86 WHIRLPOOL 376a8bbf7ee1dc829c4f6fb1a4b8f28572fe43ff6a516bf19884ed1e4774358624e5ed57fdf8648742c170f5ff01169569d4e61855fbbfb6e6cfdbf26034caae
+DIST UDK2015.Complete.MyWorkSpace.zip 121736982 SHA256 ff11e68feafae13510ad5ee951bf7b219b3483ab335c1d0c85f45a5b7ba48b5e SHA512 7856a8f29296f817e8fd09d8eaf7207f4e25a13faa10936d1ceb10cb6a900be265379722c0ade0ef93b1c640fef8693667d2567962e3288b20ae77f607f03d39 WHIRLPOOL 8b1e283e0ae3ec422eea609a418784260119410a87c5397803730f1c73be0b113eec41ed4cd1920d32735a23377acd80bedf1867518733be6d698c3891775276
+EBUILD udk-2015.ebuild 8401 SHA256 0cf669eaca16ee872f7e49dc67ae73944021954847aa2e74eac1ed7257e24e9e SHA512 7cd8fa58cb06e9d9bfbe93c8f2b84a0579706422d12ce3eb970b319b4025f191fb0d2578d70e6d28045d12c8fc12419951b83163e77671ac8ee2e0d355e82a22 WHIRLPOOL 7f07173812c7d27627864cf414e92b8c0120ccb34359a5fe5e36ea457b4c36e191793f25ef1347832e736f75a8f6dba047b2b69022f6e81beae67bc86af52ee9
+MISC ChangeLog 799 SHA256 951d1dc2b800802013f538775b4cf1a8c7c33490e77b502232d1c662706dc531 SHA512 983f5ece33654f612c1034ce633e6ed5c7696e19048e926093d99a74ee031e3e6d5c34c5a4f0bc2709cb536ca02688e1eae600438873fd377a6a92ae40298682 WHIRLPOOL d363134dd6e65d627561e79f1f99ba00a7f1c1483f4e6ca4d560ec006338ac6a411c4eaa3cafd464003ec6961d40dbdf607581e464e1c586fdfbde76d29b951a
+MISC metadata.xml 721 SHA256 0b8f3ba65452abb55f323dd8a2c7bdc52f40fa967cdc5f3c95380fa36e656682 SHA512 20ac00286729ab06e607513002f2bcfe75866108914015d11a3139f95073b393c62046832fd3295f4e849a5cc810b996f0ca8b589cc6639e726563110e1c60fe WHIRLPOOL 0285d410c73903cf5c3be60b647069c76eb6d303fcfc3314b5da9b14a602589d5064b29723bc61bac26c0da25c608de153e4e190cbe6973ff640c702224494ae
diff --git a/sys-boot/udk/files/2015-makefile.template b/sys-boot/udk/files/2015-makefile.template
new file mode 100644
index 000000000000..c8ae8b6b420e
--- /dev/null
+++ b/sys-boot/udk/files/2015-makefile.template
@@ -0,0 +1,54 @@
+TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
+EXEC = «MODULE».efi
+SRC = $(shell find $(TOP) -type f -name '*.c')
+OBJ = $(SRC:.c=.o)
+INC_DIR = /usr/include/«PACKAGE_NAME»
+LIB_DIR = /usr/lib
+«STATIC_LIBS»
+
+EFI_LDS = $(LIB_DIR)/GccBase.lds
+
+«MODULE_TYPE»
+«IMAGE_ENTRY_POINT»
+
+«CP»
+«RM»
+«CC»
+«DLINK»
+«OBJCOPY»
+«GENFW»
+
+CC_FLAGS = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror \
+ -Wno-array-bounds -ffunction-sections -fdata-sections -c -iquote$(TOP) \
+ -include AutoGen.h -I$(INC_DIR) -DSTRING_ARRAY_NAME=«MODULE»Strings -m64 \
+ -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS \
+ -mno-red-zone -Wno-address -mcmodel=large -Wno-address \
+ -Wno-unused-but-set-variable
+DLINK_FLAGS=-nostdlib -n -q --gc-sections --entry $(IMAGE_ENTRY_POINT) \
+ -u $(IMAGE_ENTRY_POINT) -melf_x86_64 --oformat=elf64-x86-64 -L $(LIB_DIR) \
+ --script=$(EFI_LDS) --defsym=PECOFF_HEADER_SIZE=«PECOFF_HEADER_SIZE»
+«OBJCOPY_FLAGS»
+«GENFW_FLAGS»
+
+all: $(EXEC)
+
+%.efi: $(OBJ)
+ $(DLINK) -o $(@:.efi=.dll) $(DLINK_FLAGS) \
+ --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) -o $@ $^
+
+clean:
+ $(RM) *.o
+
+mrproper: clean
+ $(RM) $(EXEC) $(EXEC:.efi=.debug)
+
+.PHONY: all clean mrproper
diff --git a/sys-boot/udk/files/2015-tools_def.template b/sys-boot/udk/files/2015-tools_def.template
new file mode 100644
index 000000000000..5c866354a85c
--- /dev/null
+++ b/sys-boot/udk/files/2015-tools_def.template
@@ -0,0 +1,42 @@
+
+#################
+# My custom toolchain
+#################
+*_CUSTOM_*_*_FAMILY = GCC
+*_CUSTOM_*_MAKE_PATH = make
+*_CUSTOM_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+*_CUSTOM_*_OBJCOPY_PATH = «OBJCOPY»
+*_CUSTOM_*_CC_PATH = «CC»
+*_CUSTOM_*_SLINK_PATH = «AR»
+*_CUSTOM_*_DLINK_PATH = «LD»
+*_CUSTOM_*_ASLDLINK_PATH = «LD»
+*_CUSTOM_*_ASM_PATH = «CC»
+*_CUSTOM_*_PP_PATH = «CC»
+*_CUSTOM_*_VFRPP_PATH = «CC»
+*_CUSTOM_*_ASLCC_PATH = «CC»
+*_CUSTOM_*_ASLPP_PATH = «CC»
+*_CUSTOM_*_RC_PATH = «OBJCOPY»
+*_CUSTOM_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_CUSTOM_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
+*_CUSTOM_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_CUSTOM_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
+*_CUSTOM_*_APP_FLAGS =
+*_CUSTOM_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_CUSTOM_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_CUSTOM_*_OBJCOPY_FLAGS =
+*_CUSTOM_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
+*_CUSTOM_IA32_ASM_FLAGS = DEF(GCC_ASM_FLAGS) -m32 -march=i386
+*_CUSTOM_IA32_CC_FLAGS = «CFLAGS» -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings -D EFI32
+*_CUSTOM_IA32_ASLDLINK_FLAGS = -nostdlib -n -q --gc-sections -z common-page-size=0x40 --entry ReferenceAcpiTable -u ReferenceAcpiTable -m elf_i386
+*_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
+*_CUSTOM_IA32_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x220
+*_CUSTOM_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+*_CUSTOM_IA32_NASM_FLAGS = -f elf32
+*_CUSTOM_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
+*_CUSTOM_X64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) -m64
+*_CUSTOM_X64_CC_FLAGS = «CFLAGS» -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS
+*_CUSTOM_X64_ASLDLINK_FLAGS = -nostdlib -n -q --gc-sections -z common-page-size=0x40 --entry ReferenceAcpiTable -u ReferenceAcpiTable -m elf_x86_64
+*_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
+*_CUSTOM_X64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x228
+*_CUSTOM_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+*_CUSTOM_X64_NASM_FLAGS = -f elf64
diff --git a/sys-boot/udk/metadata.xml b/sys-boot/udk/metadata.xml
new file mode 100644
index 000000000000..422810daaa88
--- /dev/null
+++ b/sys-boot/udk/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>sveyret@gmail.com</email>
+ <name>Stéphane Veyret</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <longdescription lang="fr">
+ Kit de développement UEFI Tianocore, une version stable de portions du
+ projet EDK II.
+ </longdescription>
+ <longdescription lang="en">
+ Tianocore UEFI Development Kit, a stable release of portions of the
+ EDK II project.
+ </longdescription>
+ <upstream>
+ <remote-id type="github">tianocore/udk</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-boot/udk/udk-2015.ebuild b/sys-boot/udk/udk-2015.ebuild
new file mode 100644
index 000000000000..877b99c94eb1
--- /dev/null
+++ b/sys-boot/udk/udk-2015.ebuild
@@ -0,0 +1,247 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="sqlite"
+
+inherit flag-o-matic multiprocessing python-single-r1 toolchain-funcs versionator
+
+MY_V="${PN^^}$(get_version_component_range 1)"
+
+DESCRIPTION="Tianocore UEFI Development kit"
+HOMEPAGE=" https://github.com/tianocore/tianocore.github.io/wiki/EDK-II"
+SRC_URI="https://github.com/tianocore/${PN}/releases/download/${MY_V}/${MY_V}.Complete.MyWorkSpace.zip"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc examples"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-lang/nasm"
+
+S="${WORKDIR}/MyWorkSpace"
+
+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}
+ fi
+
+ # We will create a custom toolchain with user defined settings
+ export TOOLCHAIN_TAG="CUSTOM"
+}
+
+src_unpack() {
+ unpack ${A}
+ unpack "${WORKDIR}/${MY_V}.MyWorkSpace.zip"
+
+ pushd "${S}" || die
+ unpack "${WORKDIR}/BaseTools(Unix).tar"
+
+ local doc_name
+ local f
+ if use doc; then
+ 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:')
+ 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
+ fi
+ done
+ popd >/dev/null || die
+ fi
+
+ popd >/dev/null || die
+}
+
+src_configure() {
+ # 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}:" \
+ -i "${S}/BaseTools/Source/C/Makefiles/header.makefile" \
+ || die "Failed to update makefile header"
+ local make_flags=(
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ AS="$(tc-getAS)"
+ AR="$(tc-getAR)"
+ LD="$(tc-getLD)"
+ )
+ emake "${make_flags[@]}" -j1 -C BaseTools
+ . 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 $(test-flags-CC -ffunction-sections)
+ append-cflags $(test-flags-CC -fdata-sections)
+ append-cflags $(test-flags-CC -fno-stack-protector)
+ append-cflags $(test-flags-CC -fno-asynchronous-unwind-tables)
+ if [[ "${ARCH}" == "X64" ]]; then
+ append-cflags $(test-flags-CC -m64) $(test-flags-CC -mno-red-zone)
+ append-cflags $(test-flags-CC -mcmodel=large)
+ else
+ append-cflags $(test-flags-CC -m32) $(test-flags-CC -malign-double)
+ fi
+ 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 "${S}/Conf/target.txt" || die "Failed to configure target file"
+ sed -e "s:«CC»:$(tc-getCC):" \
+ -e "s:«AR»:$(tc-getAR):" \
+ -e "s:«LD»:$(tc-getLD):" \
+ -e "s:«OBJCOPY»:$(tc-getOBJCOPY):" \
+ -e "s:«CFLAGS»:${CFLAGS}:" \
+ "${FILESDIR}/${PV}-tools_def.template" >>"${S}/Conf/tools_def.txt" \
+ || die "Failed to prepare tools definition file"
+}
+
+src_compile() {
+ local build_target
+ if use examples; then
+ build_target=all
+ else
+ build_target=libraries
+ fi
+
+ build ${build_target} || die "Failed to compile environment"
+}
+
+src_install() {
+ local f
+ 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
+ done
+ dolib "${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
+ 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
+
+ dobin "${S}/BaseTools/Source/C/bin/GenFw"
+
+ if use doc; then
+ 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"
+ 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
+}
+
+##
+# 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 $(dirname "${dest_file}") || die
+ mv "${filename}" "${dest_file}" || die
+ done < <(find "${1}" -name '*.h' -print0 -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;
+ [[ $ARCH == X64 ]] && pecoff_header_size='0x228' || pecoff_header_size='0x220'
+ sed -e "s:«MODULE»:${2}:" \
+ -e "s:«PACKAGE_NAME»:${PN}:" \
+ -e "s:«STATIC_LIBS»:${static_libs}:" \
+ -e "s:«MODULE_TYPE»:$(grep -e '^MODULE_TYPE\s*=' ${3} | tail -1):" \
+ -e "s:«IMAGE_ENTRY_POINT»:$(grep -e '^IMAGE_ENTRY_POINT\s*=' ${3}):" \
+ -e "s:«CP»:$(grep -e '^CP\s*=' ${3}):" \
+ -e "s:«RM»:$(grep -e '^RM\s*=' ${3}):" \
+ -e "s:«CC»:$(grep -e '^CC\s*=' ${3}):" \
+ -e "s:«DLINK»:$(grep -e '^DLINK\s*=' ${3}):" \
+ -e "s:«OBJCOPY»:$(grep -e '^OBJCOPY\s*=' ${3}):" \
+ -e "s:«GENFW»:$(grep -e '^GENFW\s*=' ${3}):" \
+ -e "s:«PECOFF_HEADER_SIZE»:${pecoff_header_size}:" \
+ -e "s:«OBJCOPY_FLAGS»:$(grep -e '^OBJCOPY_FLAGS\s*=' ${3}):" \
+ -e "s:«GENFW_FLAGS»:$(grep -e '^GENFW_FLAGS\s*=' ${3}):" \
+ "${FILESDIR}/${PV}-makefile.template" >${1} \
+ || die "Failed to create Makefile"
+}