# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils toolchain-funcs #note from ebuild writer: following line is used for rendering metadata.xml #LONG_DESCRIPTION="The flat assembler is a fast and efficient self-assembling 80x86 assembler for DOS, Windows and Linux operating systems. Currently it supports all 8086-80486/Pentium instructions with MMX, SSE, SSE2, SSE3 and 3DNow! extensions, can produce output in binary, MZ, PE, COFF or ELF format. It includes the powerful but easy to use macroinstruction support and does multiple passes to optimize the instruction codes for size. The flat assembler is self-compilable and the full source code is included." DESCRIPTION="The flat assembler is a fast and efficient self-assembling multi-platform 80x86 assembler." HOMEPAGE="http://flatassembler.net" SRC_URI="http://flatassembler.net/fasm-${PV}.tgz" # TODO: license add to /use/portage/licenses LICENSE="fasm" # actually, it should be x86 (but I haven't tested it myself on x86), and amd64 - but afaik the policy says <2 months as ~ in the portage before "stable"... KEYWORDS="~x86 ~amd64" SLOT="0" IUSE="rebuild no_usr_bin libc" #note from ebuild writer: well, here's an explanation of the USE I use... (pun intended, you may not laught ;) # IUSE # rebuild - force rebuild # no_usr_bin - don't add a symlink in /usr/bin/fasm -> /opt/fasm/fasm # libc - patch to use libc DEPEND="libc? ( virtual/libc )" S=${WORKDIR}/fasm src_unpack() { unpack ${A} use libc > /dev/null && epatch "${FILESDIR}/fasm-${PV}-libc.patch" if use rebuild > /dev/null || libc > /dev/null ; then einfo "Will rebuild fasm..." if use amd64 || use ~amd64 ; then # if -m32 isn't supported/implemented we won't get a 32-bin einfo "Notice: Building of 32-bit (libc) version of fasm might fail on x86-64/amd64." einfo "Notice: Curenly running fasm on amd64/x86_64 isn't \"officially\" supported." fi fi if use amd64 || use ~amd64 ; then einfo "Notice: You'll need IA32 eumlation support since fasm is be a 32-bit app." fi } src_compile() { if use rebuild > /dev/null || use libc > /dev/null ; then # rebuild fasm: einfo "Rebuilding libc fasm..." if use libc > /dev/null ; then echo -n "fasm.o..." ${S}/fasm ${S}/source/libc/fasm.asm ${S}/fasm.o > /dev/null rm ${S}/fasm > /dev/null echo -e "\bdone!" echo -n "fasm..." if use amd64 > /dev/null || use ~amd64 > /dev/null ; then `tc-getCC` -m32 ${S}/fasm.o -o ${S}/fasm > /dev/null else `tc-getCC` ${S}/fasm.o -o ${S}/fasm > /dev/null fi if [ $? != 0 ] || [ ! -e ${S}/fasm ] || [ ! -e ${S}/fasm ] ; then eerror "Building failed!" die "Building failed!" fi rm ${S}/fasm.o else echo -n "fasm..." ${S}/fasm ${S}/source/Linux/fasm.asm ${S}/fasm.2 > /dev/null mv ${S}/fasm.2 ${S}/fasm > /dev/null fi echo -e "\bdone!" fi } src_install() { #${D} = virutal / dodir /opt/fasm mv ${S}/* ${D}opt/fasm # adjust permissions. find ${D}opt/fasm \( -iname '*.txt' -or -iname '*.asm' -or -iname '*.inc' -or -iname '*.o' \) -exec chmod 774 {} \; chmod 775 ${D}opt/fasm/fasm ${D}opt/fasm/examples/elfexe/hello find ${D}opt/fasm -type d -exec chmod 775 {} \; #@gen2 devs: it this "legal" for ebuilds? (ie is there anyway to make it do the symlink like: ln -s ${WILL_BE_MY_ROOT}/opt/fasm ${D}usr/bin/fasm). dodir /usr/bin if use !no_usr_bin ; then ln -s /opt/fasm/fasm ${D}usr/bin/fasm fi }