dev-lang/fbc: New package

Closes: https://bugs.gentoo.org/96711
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
This commit is contained in:
William Breathitt Gray
2019-04-04 14:36:44 +09:00
parent 61e92cd4f6
commit e1b76eb6fa
8 changed files with 8884 additions and 0 deletions

2
dev-lang/fbc/Manifest Normal file
View File

@@ -0,0 +1,2 @@
DIST FreeBASIC-1.06.0-source-bootstrap.tar.xz 7742292 BLAKE2B fd32c6e5edf6e8c27538465141c6b870d6c893f8e05fc8d91b273f9268a68065709cba95e8c5cd8b86786522b2ac1eaf1a6a547227432bbc9998eb1288b29515 SHA512 42878091994cae7e0a2f4ba1d2d83a80d32d62ad06790ac06643a266200b53b7ce2480a651b1622910a2733756b7ca032a5be1bb73ee3f796146394eebb9f43c
DIST fbc-1.06.0.tar.gz 8847831 BLAKE2B 9245137995f9f3e2ff5adaf9b273593434ac9ec96919b2c970ec26183fe6fb7afee35753f2dd92f4b34d1aade92871e5a6722571a5ba04dde323fd7fb06c55c5 SHA512 687dcf665bb10e6a771cc01d02c21da77d89e052308600038dce526ba1ccfc6554d409dab184f3495557c9e4fdf744fd7a9088b4b137b782a9ab8633622c5484

View File

@@ -0,0 +1,93 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION="FreeBASIC - A free/open source, multi-platform BASIC compiler."
HOMEPAGE="https://www.freebasic.net"
SRC_URI="https://github.com/freebasic/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
https://github.com/freebasic/${PN}/releases/download/${PV}/FreeBASIC-${PV}-source-bootstrap.tar.xz"
LICENSE="FDL-1.2 GPL-2+ LGPL-2.1+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="gpm libffi opengl X"
DEPEND="
sys-libs/ncurses:=
gpm? ( sys-libs/gpm )
libffi? ( virtual/libffi )
opengl? ( virtual/opengl )
X? (
x11-libs/libX11
x11-libs/libXext
x11-libs/libXpm
x11-libs/libXrandr
x11-libs/libXrender
)"
RDEPEND="${DEPEND}"
PATCHES="${FILESDIR}/${PV}/${PN}"
DOCS="${S}/doc/fbc.1"
BOOTSTRAP_S="${WORKDIR}/FreeBASIC-${PV}-source-bootstrap"
src_unpack() {
# We only need bootstrap source code if fbc is not already present
if ! has_version dev-lang/fbc; then
unpack FreeBASIC-${PV}-source-bootstrap.tar.xz
fi
unpack ${P}.tar.gz
}
src_prepare() {
# We only need bootstrap source code if fbc is not already present
if ! has_version dev-lang/fbc; then
cd "${BOOTSTRAP_S}" || die "cd failed"
eapply "${FILESDIR}/${PV}/bootstrap"
cd "${S}" || die "cd failed"
fi
default
}
src_compile() {
local fbc="fbc"
local fbcflags=""
# We only need bootstrap compiler if fbc is not already present
if ! has_version dev-lang/fbc; then
cd "${BOOTSTRAP_S}" || die "cd failed"
# Build bootstrap compiler
emake bootstrap-minimal
# Set bootstrap compiler to build fbc
fbc="${BOOTSTRAP_S}/bin/fbc"
fbcflags="-i ${BOOTSTRAP_S}/inc"
cd "${S}" || die "cd failed"
fi
local xcflags=$(usex gpm "" "-DDISABLE_GPM")
xcflags+=$(usex libffi "" " -DDISABLE_FFI")
xcflags+=$(usex opengl "" " -DDISABLE_OPENGL")
xcflags+=$(usex X "" " -DDISABLE_X11")
# fbc automatically strips the executables it compiles; in order to avoid
# creating striped executables, we override the fbc hardcoded linker "-s"
# flag with our own; "--strip-debug" was chosen arbitrarily (without the
# "-g" flag the executable should not have debug_info symbols anyway, so the
# "--strip-debug" flag should be a safe option)
local fblflags="-Wl --strip-debug "
# fbc requires a space after the -Wl option
fblflags+=$(echo "${LDFLAGS}" | sed 's/-Wl,/-Wl /g')
# Build fbc
emake CFLAGS="${CFLAGS} ${xcflags}" FBC="${fbc}" FBCFLAGS="${fbcflags}" FBLFLAGS="${fblflags}"
}
src_install() {
emake DESTDIR="${D}" prefix="/usr" install
einstalldocs
}

View File

@@ -0,0 +1,37 @@
From 94764a6bf44ab9146e23fb0559ef99f35ceeec79 Mon Sep 17 00:00:00 2001
From: William Breathitt Gray <vilhelm.gray@gmail.com>
Date: Sat, 6 Apr 2019 11:20:10 +0900
Subject: [PATCH] makefile: Fix bootstrap recipe race condition
Since fbrt0.o and libfb.a are statically linked to the bootstrap fbc,
rtlib should be listed as a dependency of BOOTSTRAP_FBC. This patch
fixes the race condition described in issue #131.
---
makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/makefile b/makefile
index aeca4c07e..0422dfff7 100644
--- a/makefile
+++ b/makefile
@@ -1063,7 +1063,7 @@ bootstrap-dist:
#
BOOTSTRAP_FBC := bootstrap/fbc$(EXEEXT)
.PHONY: bootstrap
-bootstrap: rtlib gfxlib2 $(BOOTSTRAP_FBC)
+bootstrap: gfxlib2 $(BOOTSTRAP_FBC)
mkdir -p bin
cp $(BOOTSTRAP_FBC) $(FBC_EXE)
@@ -1089,7 +1089,7 @@ endif
ifneq ($(filter darwin freebsd linux netbsd openbsd solaris,$(TARGET_OS)),)
BOOTSTRAP_LIBS := -lncurses -lm -pthread
endif
-$(BOOTSTRAP_FBC): $(BOOTSTRAP_OBJ)
+$(BOOTSTRAP_FBC): rtlib $(BOOTSTRAP_OBJ)
$(QUIET_LINK)$(CC) -o $@ $(libdir)/fbrt0.o bootstrap/$(FBTARGET)/*.o $(libdir)/libfb.a $(BOOTSTRAP_LIBS)
.PHONY: clean-bootstrap
--
2.21.0

View File

@@ -0,0 +1,56 @@
From dc6e5a3b68810d0e97625b57055bd98678e13a53 Mon Sep 17 00:00:00 2001
From: William Breathitt Gray <vilhelm.gray@gmail.com>
Date: Tue, 9 Apr 2019 18:51:38 +0900
Subject: [PATCH] makefile: Implement bootstrap-minimal target
The bootstrap-minimal target builds a bootstrap fbc with only the
minimal features necessary to build another fbc.
---
makefile | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/makefile b/makefile
index 0422dfff7..245e95669 100644
--- a/makefile
+++ b/makefile
@@ -64,8 +64,9 @@
# warning-tests
# clean-tests
#
-# bootstrap-dist Create source package with precompiled fbc sources
-# bootstrap Build fbc from the precompiled sources (only if precompiled sources exist)
+# bootstrap-dist Create source package with precompiled fbc sources
+# bootstrap Build fbc from the precompiled sources (only if precompiled sources exist)
+# bootstrap-minimal Build fbc from the precompiled sources (only if precompiled sources exist) with only the minimal features needed to compile another fbc
#
# makefile configuration:
# FB[C|L]FLAGS to set -g -exx etc. for the compiler build and/or link
@@ -368,6 +369,11 @@ ALLFBCFLAGS += -e -m fbc -w pedantic
ALLFBLFLAGS += -e -m fbc -w pedantic
ALLCFLAGS += -Wall -Wextra -Wno-unused-parameter -Werror-implicit-function-declaration
+ifneq ($(filter bootstrap-minimal, $(MAKECMDGOALS)),)
+ # Disable features not needed to compile a minimal bootstrap fbc
+ ALLCFLAGS += -DDISABLE_GPM -DDISABLE_FFI -DDISABLE_X11
+endif
+
ifeq ($(TARGET_OS),xbox)
ifeq ($(OPENXDK),)
$(error Please set OPENXDK=<OpenXDK directory>)
@@ -1061,9 +1067,11 @@ bootstrap-dist:
# Build the fbc[.exe] binary from the precompiled sources in the bootstrap/
# directory.
#
+.PHONY: bootstrap bootstrap-minimal
+bootstrap: gfxlib2 bootstrap-minimal
+
BOOTSTRAP_FBC := bootstrap/fbc$(EXEEXT)
-.PHONY: bootstrap
-bootstrap: gfxlib2 $(BOOTSTRAP_FBC)
+bootstrap-minimal: $(BOOTSTRAP_FBC)
mkdir -p bin
cp $(BOOTSTRAP_FBC) $(FBC_EXE)
--
2.21.0

View File

@@ -0,0 +1,35 @@
From d1e485d6f1beb39e3228f86c2448b2fac77d1e62 Mon Sep 17 00:00:00 2001
From: William Breathitt Gray <vilhelm.gray@gmail.com>
Date: Sun, 21 Apr 2019 19:10:48 +0900
Subject: [PATCH] Pass down all options from all -Wa, -Wc, and -Wl flags
All options from all -Wa, -Wc, and -Wl flags are passed down to their
respective programs. This fixes issue #137.
---
src/compiler/fbc.bas | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas
index 0f04217a1..f6fa3d9db 100644
--- a/src/compiler/fbc.bas
+++ b/src/compiler/fbc.bas
@@ -1869,13 +1869,13 @@ private sub handleOpt(byval optid as integer, byref arg as string)
end if
case OPT_WA
- fbc.extopt.gas = " " + hReplace( arg, ",", " " ) + " "
+ fbc.extopt.gas += " " + hReplace( arg, ",", " " ) + " "
case OPT_WC
- fbc.extopt.gcc = " " + hReplace( arg, ",", " " ) + " "
+ fbc.extopt.gcc += " " + hReplace( arg, ",", " " ) + " "
case OPT_WL
- fbc.extopt.ld = " " + hReplace( arg, ",", " " ) + " "
+ fbc.extopt.ld += " " + hReplace( arg, ",", " " ) + " "
case OPT_X
fbc.outname = arg
--
2.21.0

23
dev-lang/fbc/metadata.xml Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<longdescription lang="en">
FreeBASIC is a completely free, open-source, multi-platform
BASIC compiler, with syntax similar to MS-QuickBASIC, that adds
new features such as pointers, unsigned data types, inline
assembly, object orientation, and many others.
</longdescription>
<maintainer type="person">
<email>vilhelm.gray@gmail.com</email>
<name>William Breathitt Gray</name>
</maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<upstream>
<bugs-to>https://github.com/freebasic/fbc/issues</bugs-to>
<doc lang="en">https://www.freebasic.net</doc>
<remote-id type="github">freebasic/fbc</remote-id>
</upstream>
</pkgmetadata>