development/fasm: Added (fast assembler for x86/x86_64).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2022-01-17 19:07:33 -05:00 committed by Willy Sudiarto Raharjo
parent ac15ff9bef
commit 1691770678
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
6 changed files with 342 additions and 0 deletions

9
development/fasm/README Normal file
View File

@ -0,0 +1,9 @@
fasm (fast assembler for the x86 and x86-64 architectures)
The flat assembler (abbreviated to fasm, intentionally stylized
with lowercase letters) is a fast assembler running in a variety
of operating systems, in continued development since 1999. It was
designed primarily for the assembly of x86 instructions and it
supports x86 and x86-64 instruction sets with extensions like MMX,
3DNow!, SSE up to SSE4, AVX, AVX2, XOP, and AVX-512. It can produce
output in plain binary, MZ, PE, COFF or ELF format.

94
development/fasm/fasm.1 Normal file
View File

@ -0,0 +1,94 @@
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "FASM" 1 "2022-01-17" "1.73.29" "SlackBuilds.org"
.SH NAME
fasm \- fast assembler for the x86 and x86-64 architectures
.\" RST source for fasm(1) man page. Convert with:
.
.\" rst2man.py fasm.rst > fasm.1
.
.\" rst2man.py comes from the SBo development/docutils package.
.
.SH SYNOPSIS
.sp
fasm [\fB\-d\fP \fIname=value\fP ...] [\fB\-m\fP \fImem\-limit\fP] [\fB\-p\fP \fIpass\-limit\fP] [\fB\-s\fP \fIsymbol\-file\fP] \fIsource\-file\fP [\fIoutput\-file\fP]
.SH DESCRIPTION
.sp
\fBfasm\fP (aka flat assembler) is a fast assembler for the x86 and
x86\-64 architectures. When executed, it will assemble the given
source file.
.sp
If no \fIoutput\-file\fP is given, the output filename will be the
\fIsource\-file\fP name with the extension replaced with \fI\&.o\fP\&.
.SH OPTIONS
.sp
The space between an option and its argument is optional (\fB\-m10\fP and
\fB\-m 10\fP are both acceptable).
.INDENT 0.0
.TP
.B \fB\-d\fP \fIname=value\fP
Predefine a symbol (variable). May be given multiple times, as needed.
.TP
.B \fB\-m\fP \fImem\-limit\fP
Set the limit in \fI1024\-byte\fP kilobytes for the amount of memory \fBfasm\fP can
use. If the limit is exceeded, \fBfasm\fP will exit with an "out of
memory" error and nonzero exit status. Default is 16384 (aka 16MB),
minimum is 1, maximum allowed is 4194303 (~4GB)... but values ~4000000 and up
can cause \fBfasm\fP to segfault.
.TP
.B \fB\-p\fP \fIpass\-limit\fP
Set the maximum number of passes \fBfasm\fP will make over the source. Default
is 100; maximum is 65536.
.TP
.B \fB\-s\fP \fIsymbol\-file\fP
Dump symbolic information for debugging to \fIsymbol\-file\fP\&. This file
can be processed with the \fBlisting\fP, \fBsymbols\fP, or \fBprepsrc\fP tools:
see /usr/doc/fasm\-1.73.29/tools\-readme.txt for details.
.UNINDENT
.SH EXIT STATUS
.sp
Zero for successful completion, 1 for invalid command\-line option(s),
or non\-zero (apparently always 255) for any fatal assembly error.
.SH COPYRIGHT
.sp
See the file /usr/doc/fasm\-1.73.29/license.txt for license information.
.SH AUTHORS
.sp
\fBfasm\fP was written by Tomasz Grysztar.
.sp
This man page written for the SlackBuilds.org project
by B. Watson, and is licensed under the WTFPL.
.SH SEE ALSO
.sp
The full documentation: /usr/doc/fasm\-1.73.29/fasm.txt
.sp
The fasm homepage: \fI\%https://flatassembler.net\fP
.\" Generated by docutils manpage writer.
.

View File

@ -0,0 +1,123 @@
#!/bin/bash
# Slackware build script for fasm
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# Note: the source archive includes the full source plus prebuilt 32-
# and 64-bit binaries. This SlackBuild uses the prebuilt binary to
# bootstrap the binary it's going to install.
# I almost didn't bother with an x86_64 option. The assembler is
# 32-bit but fully static, will run fine on 64-bit without multilib,
# and there doesn't seem to be any advantage to using the 64-bit
# native binary... but upstream provides it, so I do too. Plus the
# tools need help on Slackware64 due to lack of multilib.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=fasm
VERSION=${VERSION:-1.73.29}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
# Build will fail on non-x86/x86_64. Let's fail ASAP though, not
# bother to extract the source.
case "$ARCH" in
i?86|x86_64) ;; # OK
*) cat <<EOF
*** $PRGNAM can only be built and run on i586, i686, or x86_64 (not '$ARCH')
EOF
exit 1
esac
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM
tar xvf $CWD/$PRGNAM-$VERSION.tgz
cd $PRGNAM
if [ "$ARCH" = "x86_64" ]; then
SRCDIR=source/Linux/x64
FASM="$(pwd)/fasm.x64"
tar xvf $CWD/fasm-prebuilt-tools-$VERSION.tar.xz
else
FASM="$(pwd)/fasm"
SRCDIR=source/Linux
fi
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# Bootstrap using the prebuilt binary.
cd $SRCDIR
$FASM fasm.asm
# The binary we just built should be byte-for-byte identical with
# the prebuilt one. If not, this will error out of the script.
cmp $FASM fasm
# Note: do not attempt to strip this (no section headers).
mkdir -p $PKG/usr/bin
install -m0755 fasm $PKG/usr/bin/fasm
cd -
# Build the tools, if we're on 32-bit. For 64-bit we use prebuilt
# statically-linked tools, since we don't have a 32-bit libc for them
# to link with. The prebuilt tools just came from running this script
# on i586, then tarring up the binaries. For some reason, the Debian
# fasm package doesn't include compiled tools, though it does include
# the sources for them (even the win32 source).
cd tools/libc
for i in listing prepsrc symbols; do
# if the file exists, it's prebuilt, we won't (and can't) build it.
if [ ! -e $i ]; then
$FASM $i.asm
gcc -static -Wl,-s -o $i $i.o
fi
install -m0755 -oroot -groot $i $PKG/usr/bin/$i
done
cd -
# Man page written for this SlackBuild. Debian had one already,
# but it's not very detailed and is missing the -d option.
mkdir -p $PKG/usr/man/man1
gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
mv tools/readme.txt tools-readme.txt
cp -a *.txt tools/*.txt examples $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View File

@ -0,0 +1,12 @@
PRGNAM="fasm"
VERSION="1.73.29"
HOMEPAGE="https://flatassembler.net"
DOWNLOAD="https://flatassembler.net/fasm-1.73.29.tgz"
MD5SUM="c66e907db5fc41da7f5883307f9f37e1"
DOWNLOAD_x86_64="https://flatassembler.net/fasm-1.73.29.tgz \
https://slackware.uk/~urchlay/src/fasm-prebuilt-tools-1.73.29.tar.xz"
MD5SUM_x86_64="c66e907db5fc41da7f5883307f9f37e1 \
f248f854b139be8d579102736afb5c90"
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

85
development/fasm/fasm.rst Normal file
View File

@ -0,0 +1,85 @@
.. RST source for fasm(1) man page. Convert with:
.. rst2man.py fasm.rst > fasm.1
.. rst2man.py comes from the SBo development/docutils package.
.. |version| replace:: 1.73.29
.. |date| date::
====
fasm
====
---------------------------------------------------
fast assembler for the x86 and x86-64 architectures
---------------------------------------------------
:Manual section: 1
:Manual group: SlackBuilds.org
:Date: |date|
:Version: |version|
SYNOPSIS
========
fasm [**-d** *name=value* ...] [**-m** *mem-limit*] [**-p** *pass-limit*] [**-s** *symbol-file*] *source-file* [*output-file*]
DESCRIPTION
===========
**fasm** (aka flat assembler) is a fast assembler for the x86 and
x86-64 architectures. When executed, it will assemble the given
source file.
If no *output-file* is given, the output filename will be the
*source-file* name with the extension replaced with *.o*.
OPTIONS
=======
The space between an option and its argument is optional (**-m10** and
**-m 10** are both acceptable).
**-d** *name=value*
Predefine a symbol (variable). May be given multiple times, as needed.
**-m** *mem-limit*
Set the limit in *1024-byte* kilobytes for the amount of memory **fasm** can
use. If the limit is exceeded, **fasm** will exit with an "out of
memory" error and nonzero exit status. Default is 16384 (aka 16MB),
minimum is 1, maximum allowed is 4194303 (~4GB)... but values ~4000000 and up
can cause **fasm** to segfault.
**-p** *pass-limit*
Set the maximum number of passes **fasm** will make over the source. Default
is 100; maximum is 65536.
**-s** *symbol-file*
Dump symbolic information for debugging to *symbol-file*. This file
can be processed with the **listing**, **symbols**, or **prepsrc** tools:
see /usr/doc/fasm-|version|/tools-readme.txt for details.
EXIT STATUS
===========
Zero for successful completion, 1 for invalid command-line option(s),
or non-zero (apparently always 255) for any fatal assembly error.
COPYRIGHT
=========
See the file /usr/doc/fasm-|version|/license.txt for license information.
AUTHORS
=======
**fasm** was written by Tomasz Grysztar.
This man page written for the SlackBuilds.org project
by B. Watson, and is licensed under the WTFPL.
SEE ALSO
========
The full documentation: /usr/doc/fasm-|version|/fasm.txt
The fasm homepage: https://flatassembler.net

View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
fasm: fasm (fast assembler for the x86 and x86-64 architectures)
fasm:
fasm: The flat assembler (abbreviated to fasm, intentionally stylized
fasm: with lowercase letters) is a fast assembler running in a variety
fasm: of operating systems, in continued development since 1999. It was
fasm: designed primarily for the assembly of x86 instructions and it
fasm: supports x86 and x86-64 instruction sets with extensions like MMX,
fasm: 3DNow!, SSE up to SSE4, AVX, AVX2, XOP, and AVX-512. It can produce
fasm: output in plain binary, MZ, PE, COFF or ELF format.
fasm:
fasm: