# $Id: PKGBUILD 193534 2013-08-22 15:56:50Z tpowa $ # Maintainer: Tobias Powalowski # Contributor: Keshav Padram <(the.ridikulus.rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)> ####### _TIANOCORE_SVN_URL="https://svn.code.sf.net/p/edk2/code/branches/UDK2010.SR1" # BaseTools MdePkg MdeModulePkg IntelFrameworkPkg IntelFrameworkModulePkg _TIANO_DIR_="tianocore-udk-svn" ####### ####### _TIANOCORE_PKG="Mde" _TIANOCORE_TARGET="RELEASE" _UDK_TARGET="${_TIANOCORE_PKG}Pkg/${_TIANOCORE_PKG}Pkg.dsc" _COMPILER="GCC46" ####### pkgname="refind-efi" pkgver="0.7.3" pkgrel="2" pkgdesc="Rod Smith's fork of rEFIt UEFI Boot Manager - built with Tianocore UDK libs" url="http://www.rodsbooks.com/refind/index.html" arch=('x86_64' 'i686') license=('GPL3' 'custom') makedepends=('subversion' 'python2') depends=('bash' 'dosfstools' 'efibootmgr') optdepends=('mactel-boot: For bless command in Apple Mac systems' 'imagemagick: For refind-mkfont script') options=('!strip' 'docs' '!makeflags') install="${pkgname}.install" source=("http://downloads.sourceforge.net/refind/refind-src-${pkgver}.zip" 'refind_linux.conf') for _DIR_ in BaseTools MdePkg MdeModulePkg IntelFrameworkPkg IntelFrameworkModulePkg ; do source+=("${_TIANO_DIR_}/${_DIR_}::svn+${_TIANOCORE_SVN_URL}/${_DIR_}") done sha1sums=('5e4b15202efc658e58e68e64af8a1b2c84aab175' '3d53eb615c3363d45feb95b9bfbf1d5491bf1c24' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP') [[ "${CARCH}" == "x86_64" ]] && _TIANO_ARCH="X64" [[ "${CARCH}" == "i686" ]] && _TIANO_ARCH="IA32" [[ "${CARCH}" == "x86_64" ]] && _TIANO_S_ARCH="x64" [[ "${CARCH}" == "i686" ]] && _TIANO_S_ARCH="ia32" _setup_env_vars() { msg "Setup UDK PATH ENV variables" export _UDK_DIR="${srcdir}/${_TIANO_DIR_}_build" export EDK_TOOLS_PATH="${_UDK_DIR}/BaseTools" } _prepare_tianocore_sources() { msg "Delete old UDK BUILD dir" rm -rf "${_UDK_DIR}/" || true msg "Create UDK BUILD dir" mkdir -p "${_UDK_DIR}/" for _DIR_ in BaseTools MdePkg MdeModulePkg IntelFrameworkPkg IntelFrameworkModulePkg ; do mv "${srcdir}/${_DIR_}" "${_UDK_DIR}/${_DIR_}" done cd "${_UDK_DIR}/" msg "Cleanup UDK config files" rm -rf "${_UDK_DIR}/Build/" || true rm -rf "${_UDK_DIR}/Conf/" || true mkdir -p "${_UDK_DIR}/Conf/" mkdir -p "${_UDK_DIR}/Build/" msg "Use python2 for UDK BaseTools" sed 's|python |python2 |g' -i "${EDK_TOOLS_PATH}/BinWrappers/PosixLike"/* || true sed 's|python |python2 |g' -i "${EDK_TOOLS_PATH}/Tests/GNUmakefile" msg "Fix GCC Warning as error" sed 's|-Werror |-Wno-error -Wno-unused-but-set-variable |g' -i "${EDK_TOOLS_PATH}/Source/C/Makefiles/header.makefile" || true sed 's|-Werror |-Wno-error -Wno-unused-but-set-variable |g' -i "${EDK_TOOLS_PATH}/Conf/tools_def.template" || true msg "Fix GCC >=4.7 error - gcc: error: unrecognized command line option '-melf_x86_64'" sed 's| -m64 --64 -melf_x86_64| -m64|g' -i "${EDK_TOOLS_PATH}/Conf/tools_def.template" || true sed 's|--64 | |g' -i "${EDK_TOOLS_PATH}/Conf/tools_def.template" || true sed 's| -m64 -melf_x86_64| -m64|g' -i "${EDK_TOOLS_PATH}/Conf/tools_def.template" || true msg "Remove GCC -g debug option and add -0s -mabi=ms" sed 's|DEFINE GCC_ALL_CC_FLAGS = -g |DEFINE GCC_ALL_CC_FLAGS = -Os -mabi=ms |g' -i "${EDK_TOOLS_PATH}/Conf/tools_def.template" || true sed 's|DEFINE GCC44_ALL_CC_FLAGS = -g |DEFINE GCC44_ALL_CC_FLAGS = -Os -mabi=ms |g' -i "${EDK_TOOLS_PATH}/Conf/tools_def.template" || true msg "Fix UDK Target Platform" sed "s|ACTIVE_PLATFORM = Nt32Pkg/Nt32Pkg.dsc|ACTIVE_PLATFORM = ${_UDK_TARGET}|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true sed "s|TARGET = DEBUG|TARGET = ${_TIANOCORE_TARGET}|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true sed "s|TOOL_CHAIN_TAG = MYTOOLS|TOOL_CHAIN_TAG = ${_COMPILER}|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true msg "Fix UDK Target ARCH for rEFInd" sed "s|X64|${_TIANO_ARCH}|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true sed "s|IA32|${_TIANO_ARCH}|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true chmod 0755 "${_UDK_DIR}/BaseTools/BuildEnv" } _prepare_refind_sources() { cd "${srcdir}/refind-${pkgver}/" msg "Fix UDK Path in rEFInd Makefiles" sed "s|EDK2BASE = /usr/local/UDK2010/MyWorkSpace|EDK2BASE = ${_UDK_DIR}|g" -i "${srcdir}/refind-${pkgver}/Make.tiano" || true sed "s|EDK2BASE = /usr/local/UDK2010/MyWorkSpace|EDK2BASE = ${_UDK_DIR}|g" -i "${srcdir}/refind-${pkgver}/filesystems/Make.tiano" || true sed "s|EDK2BASE = /usr/local/UDK2010/MyWorkSpace|EDK2BASE = ${_UDK_DIR}|g" -i "${srcdir}/refind-${pkgver}/gptsync/Make.tiano" || true } prepare() { _setup_env_vars msg "Prepare Tianocore Sources" _prepare_tianocore_sources msg "Prepare rEFInd Sources" _prepare_refind_sources } build() { _setup_env_vars cd "${_UDK_DIR}/" msg "Unset all compiler FLAGS" unset CFLAGS unset CPPFLAGS unset CXXFLAGS unset LDFLAGS unset MAKEFLAGS msg "Setup UDK Environment" source "${_UDK_DIR}/BaseTools/BuildEnv" BaseTools echo msg "Compile UDK BaseTools" make -C "${EDK_TOOLS_PATH}" echo msg "Compile UDK Libraries" "${EDK_TOOLS_PATH}/BinWrappers/PosixLike/build" -p "${_UDK_TARGET}" -a "${_TIANO_ARCH}" -b "${_TIANOCORE_TARGET}" -t "${_COMPILER}" echo cd "${srcdir}/refind-${pkgver}/" msg "Unset all compiler FLAGS" unset CFLAGS unset CPPFLAGS unset CXXFLAGS unset LDFLAGS unset MAKEFLAGS msg "Compile rEFInd UEFI application" make tiano echo msg "Compile UEFI FS drivers" make fs echo } package() { msg "Install the rEFInd UEFI application" install -d "${pkgdir}/usr/share/refind/" install -D -m0644 "${srcdir}/refind-${pkgver}/refind/refind_${_TIANO_S_ARCH}.efi" "${pkgdir}/usr/share/refind/refind_${_TIANO_S_ARCH}.efi" msg "Install UEFI drivers built from rEFInd" install -d "${pkgdir}/usr/share/refind/drivers_${_TIANO_S_ARCH}/" install -D -m0644 "${srcdir}/refind-${pkgver}/drivers_${_TIANO_S_ARCH}"/*.efi "${pkgdir}/usr/share/refind/drivers_${_TIANO_S_ARCH}/" msg "Install UEFI applications built from rEFInd" install -d "${pkgdir}/usr/share/refind/tools_${_TIANO_S_ARCH}" install -D -m0644 "${srcdir}/refind-${pkgver}/gptsync/gptsync_${_TIANO_S_ARCH}.efi" "${pkgdir}/usr/share/refind/tools_${_TIANO_S_ARCH}/gptsync_${_TIANO_S_ARCH}.efi" msg "Install rEFInd helper scripts" install -d "${pkgdir}/usr/bin/" install -D -m0755 "${srcdir}/refind-${pkgver}/install.sh" "${pkgdir}/usr/bin/refind-install" install -D -m0755 "${srcdir}/refind-${pkgver}/mkrlconf.sh" "${pkgdir}/usr/bin/refind-mkrlconf" install -D -m0755 "${srcdir}/refind-${pkgver}/mvrefind.sh" "${pkgdir}/usr/bin/refind-mvrefind" install -D -m0755 "${srcdir}/refind-${pkgver}/fonts/mkfont.sh" "${pkgdir}/usr/bin/refind-mkfont" msg "Install the rEFInd sample config files" install -D -m0644 "${srcdir}/refind-${pkgver}/refind.conf-sample" "${pkgdir}/usr/share/refind/refind.conf-sample" install -D -m0644 "${srcdir}/refind_linux.conf" "${pkgdir}/usr/share/refind/refind_linux.conf-sample" msg "Install the rEFInd docs" install -d "${pkgdir}/usr/share/refind/docs/html/" install -d "${pkgdir}/usr/share/refind/docs/Styles/" install -D -m0644 "${srcdir}/refind-${pkgver}/docs/refind"/* "${pkgdir}/usr/share/refind/docs/html/" install -D -m0644 "${srcdir}/refind-${pkgver}/docs/Styles"/* "${pkgdir}/usr/share/refind/docs/Styles/" install -D -m0644 "${srcdir}/refind-${pkgver}/README.txt" "${pkgdir}/usr/share/refind/docs/README.txt" install -D -m0644 "${srcdir}/refind-${pkgver}/NEWS.txt" "${pkgdir}/usr/share/refind/docs/NEWS.txt" rm -f "${pkgdir}/usr/share/refind/docs/html/.DS_Store" || true msg "Install the rEFInd fonts" install -d "${pkgdir}/usr/share/refind/fonts/" install -D -m0644 "${srcdir}/refind-${pkgver}/fonts"/* "${pkgdir}/usr/share/refind/fonts/" rm -f "${pkgdir}/usr/share/refind/fonts/mkfont.sh" msg "Install the rEFInd icons" install -d "${pkgdir}/usr/share/refind/icons/" install -D -m0644 "${srcdir}/refind-${pkgver}/icons"/* "${pkgdir}/usr/share/refind/icons/" msg "Install the rEFInd images" install -d "${pkgdir}/usr/share/refind/images/" install -D -m0644 "${srcdir}/refind-${pkgver}/images"/*.{png,bmp} "${pkgdir}/usr/share/refind/images/" msg "Install the rEFInd keys" install -d "${pkgdir}/usr/share/refind/keys/" install -D -m0644 "${srcdir}/refind-${pkgver}/keys"/* "${pkgdir}/usr/share/refind/keys/" msg "Install the rEFIt license file, since rEFInd is a fork of rEFIt" install -d "${pkgdir}/usr/share/licenses/refind/" install -D -m0644 "${srcdir}/refind-${pkgver}/LICENSE.txt" "${pkgdir}/usr/share/licenses/refind/LICENSE" msg "Use '#!/usr/bin/env bash' in all scripts" sed 's|#!/bin/bash|#!/usr/bin/env bash|g' -i "${pkgdir}/usr/bin"/refind-* || true msg "Point refind dir paths to /usr/share/refind/ in refind-install script" sed 's|^ThisDir=.*|ThisDir="/usr/share/refind/"|g' -i "${pkgdir}/usr/bin/refind-install" sed 's|^RefindDir=.*|RefindDir="/usr/share/refind/"|g' -i "${pkgdir}/usr/bin/refind-install" sed 's|^ThisScript=.*|ThisScript="/usr/bin/refind-install"|g' -i "${pkgdir}/usr/bin/refind-install" } sha1sums=('baac40c10b26b337c85248aa8e2b61ab4f06f73d' '3d53eb615c3363d45feb95b9bfbf1d5491bf1c24' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP')