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

Add make-dist support and github workflow #9

Open
wants to merge 11 commits 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
77 changes: 77 additions & 0 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Makefile CI

on: push

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Install dependencies
run: |
sudo apt update
sudo apt install pandoc texlive-latex-base texlive-latex-recommended

- name: Cache Tcl build
id: cache-tcl
uses: actions/cache@v4
with:
path: /opt/tcl8.7
key: ${{ runner.os }}-f7629abff2

- name: Build Tcl 8.7
if: steps.cache-tcl.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/src/tcl
cd /tmp/src/tcl
wget https://core.tcl-lang.org/tcl/tarball/f7629abff2/tcl.tar.gz -O - | tar xz --strip-components=1
cd unix
./configure CFLAGS="-DPURIFY" --enable-symbols --enable-testmode --prefix=/opt/tcl8.7
make -j 8
sudo make install

- uses: actions/checkout@v4
with:
submodules: 'true'

- name: Build parse_args
run: |
autoconf
./configure --with-tcl=/opt/tcl8.7/lib --enable-testmode
make

- name: Run tests
run: make test 2>&1 | tee /tmp/test_results.log

- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test-results
path: /tmp/test_results.log

- name: Dist
#if: startsWith(github.ref, 'refs/tags/v')
run: |
make dist
- uses: actions/upload-artifact@v4
with:
name: release-tarball
path: /tmp/dist/parse_args*.tar.gz

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: false
prerelease: true
files: |
/tmp/dist/parse_args*.tar.gz

token: ${{ secrets.GITHUB_TOKEN }}

# - name: debug
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.swp
*.o
*.so
*.dll
pkgIndex.tcl
Makefile
core
Expand Down
64 changes: 26 additions & 38 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,8 @@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) \

GDB = gdb
VALGRIND = valgrind
VALGRINDEXTRA =
VALGRINDARGS = --tool=memcheck --num-callers=8 --leak-resolution=high \
--leak-check=yes -v --suppressions=suppressions --keep-debuginfo=yes \
--trace-children=yes $(VALGRINDEXTRA)

PGOGEN_BUILD = -fprofile-generate=prof
PGO_BUILD = @PGO_BUILD@
PGO=
CFLAGS += $(PGO)
--leak-check=yes --show-reachable=yes -v

.SUFFIXES: .c .$(OBJEXT)

Expand Down Expand Up @@ -260,21 +253,9 @@ test: binaries libraries
-load "package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
[list load `@CYGPATH@ $(PKG_LIB_FILE)` $(PACKAGE_NAME)]"

benchmark: binaries libraries
$(TCLSH) `@CYGPATH@ $(srcdir)/bench/run.tcl` $(BENCHFLAGS) -load package\ ifneeded\ $(PACKAGE_NAME)\ $(PACKAGE_VERSION)\ [list\ load\ `@CYGPATH@ $(PKG_LIB_FILE)`\ [string\ totitle\ $(PACKAGE_NAME)]]

shell: binaries libraries
@$(TCLSH) $(SCRIPT)

vim-gdb: binaries libraries
$(TCLSH_ENV) $(PKG_ENV) vim -c "set number" -c "set mouse=a" -c "set foldlevel=100" -c "Termdebug --args $(TCLSH_PROG) tests/all.tcl $(TESTFLAGS) -singleproc 1 -load package\ ifneeded\ $(PACKAGE_NAME)\ $(PACKAGE_VERSION)\ [list\ load\ `@CYGPATH@ $(PKG_LIB_FILE)`\ [string\ totitle\ $(PACKAGE_NAME)]]" generic/parse_args.c

vim-core:
$(TCLSH_ENV) $(PKG_ENV) vim -c 'packadd termdebug' -c "set mouse=a" -c "set number" -c "set foldlevel=100" -c "Termdebug -ex layout\ asm -ex layout\ regs -ex focus\ cmd $(TCLSH_PROG) core" -c Winbar generic/main.c

vim-gdb-benchmark: binaries libraries
$(TCLSH_ENV) $(PKG_ENV) vim -c "set number" -c "set mouse=a" -c "set foldlevel=100" -c "Termdebug --args $(TCLSH_PROG) bench/run.tcl $(TESTFLAGS) -load package\ ifneeded\ $(PACKAGE_NAME)\ $(PACKAGE_VERSION)\ [list\ load\ `@CYGPATH@ $(PKG_LIB_FILE)`\ [string\ totitle\ $(PACKAGE_NAME)]]" generic/parse_args.c

gdb:
$(TCLSH_ENV) $(PKG_ENV) $(GDB) $(TCLSH_PROG) $(SCRIPT)

Expand All @@ -285,14 +266,6 @@ gdb-test: binaries libraries
-load "package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
[list load `@CYGPATH@ $(PKG_LIB_FILE)` $(PACKAGE_NAME)]"

pgo:
rm -rf prof
make -C . PGO="$(PGOGEN_BUILD)" clean binaries libraries test benchmark
make -C . PGO="$(PGO_BUILD)" clean binaries libraries

coverage:
make -C . PGO="--coverage" clean binaries libraries test

valgrind: binaries libraries
$(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) \
`@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
Expand Down Expand Up @@ -353,7 +326,8 @@ DIST_ROOT = /tmp/dist
DIST_DIR = $(DIST_ROOT)/$(PKG_DIR)

DIST_INSTALL_DATA = CPPROG='cp -p' $(INSTALL) -m 644
DIST_INSTALL_SCRIPT = CPPROG='cp -p' $(INSTALL) -m 755
DIST_INSTALL_SCRIPT = CPPROG='cp -p' $(INSTALL)
DIST_INSTALL_ASIS = cp -a

dist-clean:
rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*
Expand All @@ -372,16 +346,32 @@ dist: dist-clean
$(srcdir)/tclconfig/tcl.m4 $(srcdir)/tclconfig/install-sh \
$(DIST_DIR)/tclconfig/

$(INSTALL_DATA_DIR) $(DIST_DIR)/teabase
$(DIST_INSTALL_DATA) \
$(srcdir)/teabase/teabase.m4 \
$(srcdir)/teabase/Makefile.in \
$(srcdir)/teabase/ax_cc_for_build.m4 \
$(srcdir)/teabase/ax_check_compile_flag.m4 \
$(srcdir)/teabase/ax_gcc_builtin.m4 \
$(srcdir)/teabase/tclstuff.h \
$(srcdir)/teabase/tip445.h \
$(srcdir)/teabase/polyfill.h \
$(DIST_DIR)/teabase/

$(INSTALL_DATA_DIR) $(DIST_DIR)/bench
$(DIST_INSTALL_DATA) \
$(srcdir)/teabase/teabase_bench-0.1.tm \
$(DIST_DIR)/bench/

# Extension files
$(DIST_INSTALL_DATA) \
$(srcdir)/ChangeLog \
$(srcdir)/README.sha \
$(srcdir)/license.terms \
$(srcdir)/README \
$(srcdir)/README.md \
$(srcdir)/LICENSE \
$(srcdir)/pkgIndex.tcl.in \
$(srcdir)/suppressions \
$(DIST_DIR)/

list='demos doc generic library mac tests unix win'; \
list='demos doc generic library mac tests unix win bench'; \
for p in $$list; do \
if test -d $(srcdir)/$$p ; then \
$(INSTALL_DATA_DIR) $(DIST_DIR)/$$p; \
Expand Down Expand Up @@ -491,12 +481,10 @@ uninstall-binaries:
rm -f $(DESTDIR)$(bindir)/$$p; \
done

tags:
ctags-exuberant generic/*

.PHONY: all binaries clean depend distclean doc install libraries test
.PHONY: gdb gdb-test valgrind valgrindshell tags
.PHONY: vim-gdb vim-core vim-gdb-benchmark

include $(top_builddir)/teabase/Makefile

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
Expand Down
1 change: 0 additions & 1 deletion bench/run.tcl

This file was deleted.

1 change: 1 addition & 0 deletions bench/run.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../teabase/run_bench.tcl
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ TEA_SETUP_COMPILER

TEA_ADD_SOURCES([parse_args.c])
TEA_ADD_HEADERS([])
TEA_ADD_INCLUDES([])
TEA_ADD_INCLUDES([-I$srcdir/teabase])
TEA_ADD_LIBS([])
TEA_ADD_CFLAGS([])
TEA_ADD_STUB_SOURCES([])
Expand Down Expand Up @@ -181,7 +181,7 @@ TEA_MAKE_LIB
TEA_PROG_TCLSH
#TEA_PROG_WISH

AC_CONFIG_FILES([Makefile pkgIndex.tcl])
AC_CONFIG_FILES([Makefile pkgIndex.tcl teabase/Makefile])
#AC_CONFIG_FILES([sampleConfig.sh])

#--------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion generic/tclstuff.h

This file was deleted.

1 change: 0 additions & 1 deletion generic/tip445.h

This file was deleted.

2 changes: 1 addition & 1 deletion teabase
Submodule teabase updated 4 files
+9 −6 Makefile.in
+0 −3 run_bench.tcl
+23 −4 tclstuff.h
+6 −0 teabase.m4