Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new package: smallerc #22569

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions packages/smallerc/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
TERMUX_PKG_HOMEPAGE=https://github.com/alexfru/SmallerC
TERMUX_PKG_DESCRIPTION="Simple and small C compiler for DOS, Windows, Linux and MacOS"
TERMUX_PKG_LICENSE="BSD 2-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.0.2
TERMUX_PKG_SRCURL=https://github.com/alexfru/SmallerC/archive/refs/tags/v${TERMUX_PKG_VERSION}+dos.win.b120a9c.tar.gz
TERMUX_PKG_SHA256=1e26ed8da461614da26379b7be1510f0e39f52a292fd0d9e54d747664f0c7ef4
TERMUX_PKG_BUILD_DEPENDS="nasm"
TERMUX_PKG_DEPENDS="nasm"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_NO_STATICSPLIT=true
TERMUX_PKG_HOSTBUILD=true

stsp marked this conversation as resolved.
Show resolved Hide resolved
termux_step_host_build() {
local _PREFIX_FOR_BUILD=${TERMUX_PREFIX}/opt/$TERMUX_PKG_NAME/cross
cd $TERMUX_PKG_SRCDIR
make prefix=$_PREFIX_FOR_BUILD
make install prefix=$_PREFIX_FOR_BUILD
make clean
export PATH="$PATH:$_PREFIX_FOR_BUILD/bin"
}

termux_step_make() {
local _PREFIX_FOR_BUILD=${TERMUX_PREFIX}/opt/$TERMUX_PKG_NAME/cross
make prefix=$PREFIX SMLRCC="${_PREFIX_FOR_BUILD}/bin/smlrcc"
}

termux_step_make_install() {
make install prefix=$PREFIX
}
28 changes: 28 additions & 0 deletions packages/smallerc/makefile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/common.mk b/common.mk
index d1272d6..3de1c52 100644
--- a/common.mk
+++ b/common.mk
@@ -2,6 +2,7 @@ prefix = /usr/local
bindir = $(prefix)/bin
libdir = $(prefix)/smlrc/lib
incdir = $(prefix)/smlrc/include
+SMLRCC ?= ./smlrcc

CFLAGS ?= -pipe -Wall -O2
CPPFLAGS += -DPATH_PREFIX='"$(prefix)"'
@@ -38,13 +39,13 @@ clean:
.SUFFIXES: .op .txt

.op.a:
- ./smlrcc -SI $(srcdir)/include -I $(srcdir)/srclib @$<
+ $(SMLRCC) -SI $(srcdir)/include -I $(srcdir)/srclib @$<

.txt.op:
awk -v l=$(srcdir)/srclib/ '/[.](c|asm)$$/{$$0=l$$0}{print}' $< > $@

$(stub):
- ./smlrcc -small $(srcdir)/srclib/dpstub.asm -o $@
+ $(SMLRCC) -small $(srcdir)/srclib/dpstub.asm -o $@

smlrpp:
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ -DSTAND_ALONE -DUCPP_CONFIG \
5 changes: 5 additions & 0 deletions packages/smallerc/smallerc-cross.subpackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TERMUX_SUBPKG_DESCRIPTION="SmallerC for host (NOT for Termux)"
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
TERMUX_SUBPKG_INCLUDE="
opt/${TERMUX_PKG_NAME}/cross/*
"
Loading