commit 3bff153f166fdd2629ed1b83da59a556303f718c Author: klemek Date: Thu Jul 17 19:34:00 2025 +0200 initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3da3081 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.c text eol=lf diff=cpp whitespace=trailing-space,space-before-tab,tab-in-indent +*.h text eol=lf diff=cpp whitespace=trailing-space,space-before-tab,tab-in-indent \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..829f028 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +build +.vscode +*.bmp +!images/* +*.cache +.deps +Makefile +*.log +*.o +.dirstamp +aclocal.m4 +compile +install-sh +missing +depcomp +Makefile.in +configure~ +config.status +margen +*.tar.gz +configure +src/margen* +*.pkg.tar.zst +pkg \ No newline at end of file diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..b3d682c --- /dev/null +++ b/Makefile.am @@ -0,0 +1,4 @@ +AUTOMAKE_OPTIONS = foreign subdir-objects -Wall +bin_PROGRAMS = forge +forge_SOURCES = src/main.c src/args.c +include_HEADERS = src/main.h src/args.h src/config.h src/types.h \ No newline at end of file diff --git a/Makefile.dev b/Makefile.dev new file mode 100644 index 0000000..a0b305e --- /dev/null +++ b/Makefile.dev @@ -0,0 +1,39 @@ +TARGET ?= forge +INSTALL_DIR ?= $(HOME)/.local/bin +TEST_ARGS ?= +SHELL := /bin/bash + +.PHONY: build +clean: + @rm -rf build + +build: + @mkdir -p build + gcc -Wall src/*.c src/*.h -lm -o build/$(TARGET) + +.PHONY: install +install: build + cp -f build/$(TARGET) $(INSTALL_DIR)/$(TARGET) + +.PHONY: time +time: build + time ./build/$(TARGET) $(TEST_ARGS) + +.PHONY: valgrind +valgrind: build + valgrind --leak-check=full -s ./build/$(TARGET) $(TEST_ARGS) + +.PHONY: release +release: + aclocal + autoconf + automake --add-missing + ./configure + make distcheck + +.PHONY: release-arch +release-arch: clean + mkdir -p build + cp PKGBUILD build + cd build && makepkg + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..9d4181a --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,20 @@ +pkgname=forge +pkgver=0.0.0 +pkgrel=1 +pkgdesc="Fusion Of Real Time Generative Effects" +arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64') +url="https://github.com/klemek/forge" +source=("${pkgname}-${pkgver}.tar.gz::https://github.com/klemek/forge/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz") +sha256sums=('TODO') +srcdir=build + +build() { + cd "$srcdir/$pkgname-$pkgver" + ./configure --prefix=/usr + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + sudo make DESTDIR="$pkgdir" install +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..ecc045c --- /dev/null +++ b/README.md @@ -0,0 +1,76 @@ +# forge + +> **F**usion **O**f **R**eal **T**ime **G**enerative **E**ffects + +TODO + +## Install + +### From release + +See [Releases](https://github.com/klemek/forge/releases) + +```sh +tar xvzf forge-x.y.z.tar.gz +cd forge-x.y.z +./configure +make +make install +``` + +### From repository (PKGBUILD) + +```sh +git clone https://github.com/klemek/forge +cd forge +forge -si +``` + + +### From repository (dev version) + +```sh +git clone https://github.com/klemek/forge +cd forge +aclocal +autoconf +automake --add-missing +./configure +make +make install +``` + +## CLI arguments + +```txt +usage: forge [--help] [-v] + +Fusion Of Real-time Generative Effects. + +options: + --help show this help message and exit + -v, --version print version +``` + +## Release guide + +```bash +# update configure.ac with new version +$EDITOR configure.ac +# make full build +make -f Makefile.dev release +# push to repo +git commit -am "forge vX.Y.Z" +git tag vX.Y.Z +git push origin master --tags +# create release from tag on github +# update PKGBUILD with new sha256 sum +sha256sum forge-x.y.z.tar.gz +make -f Makefile.dev release-arch +git commit -am "update arch sha256" +# add .pkg.tar.zst on the release +``` + +## Roadmap + +TODO \ No newline at end of file diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..7fe6bf2 --- /dev/null +++ b/configure.ac @@ -0,0 +1,10 @@ +AC_INIT([forge], [0.0.0], [klemek.dev@proton.me]) +AM_INIT_AUTOMAKE +AC_PROG_CC +AC_CHECK_HEADERS([stdio.h]) +AC_CHECK_HEADERS([stdlib.h]) +AC_CHECK_HEADERS([stdbool.h]) +AC_CHECK_HEADERS([string.h]) +AC_CHECK_HEADERS([time.h]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT \ No newline at end of file diff --git a/src/args.c b/src/args.c new file mode 100644 index 0000000..f6fbed2 --- /dev/null +++ b/src/args.c @@ -0,0 +1,53 @@ +#include "args.h" +#include "config.h" +#include +#include +#include +#include + +void print_help(int status_code) { + puts(PACKAGE " " VERSION "\n\n" + "usage: " PACKAGE " " + "[--help] " + "[-v] " + "\n\n" + "Fusion Of Real-time Generative Effects.\n\n" + "options:\n" + " --help show this help message and exit\n" + " -v, --version print version\n"); + exit(status_code); +} + +void invalid_arg(char *arg) { + fprintf(stderr, "invalid argument: '%s'\n\n", arg); + print_help(1); +} + +bool is_arg(char *arg, char *ref) { return strcoll(arg, ref) == 0; } + +char *split_arg_value(char *arg) { + strtok(arg, "="); + return strtok(NULL, "="); +} + +parameters parse_args(int argc, char **argv) { + parameters params; + + int i; + char *arg; + char *value; + for (i = 1; i < argc; i++) { + arg = argv[i]; + value = split_arg_value(arg); + if (is_arg(arg, "--help")) { + print_help(0); + } else if (is_arg(arg, "-v") || is_arg(arg, "--version")) { + puts(PACKAGE " " VERSION); + exit(0); + } else { + invalid_arg(arg); + } + } + + return params; +} \ No newline at end of file diff --git a/src/args.h b/src/args.h new file mode 100644 index 0000000..bb1dd73 --- /dev/null +++ b/src/args.h @@ -0,0 +1,8 @@ +#include "types.h" + +#ifndef ARGS_H +#define ARGS_H + +parameters parse_args(int argc, char **argv); + +#endif \ No newline at end of file diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..3dc61d6 --- /dev/null +++ b/src/config.h @@ -0,0 +1,12 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#ifndef PACKAGE +#define PACKAGE "forge" +#endif + +#ifndef VERSION +#define VERSION "(dev)" +#endif + +#endif \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..e9e3aa0 --- /dev/null +++ b/src/main.c @@ -0,0 +1,8 @@ +#include "args.h" + +int main(int argc, char **argv) { + parameters params; + params = parse_args(argc, argv); + // TODO + return 0; +} \ No newline at end of file diff --git a/src/main.h b/src/main.h new file mode 100644 index 0000000..b0790ce --- /dev/null +++ b/src/main.h @@ -0,0 +1,4 @@ +#ifndef MAIN_H +#define MAIN_H + +#endif \ No newline at end of file diff --git a/src/types.h b/src/types.h new file mode 100644 index 0000000..f9bb823 --- /dev/null +++ b/src/types.h @@ -0,0 +1,10 @@ +#ifndef TYPES_H +#define TYPES_H + +struct Parameters { + // TODO +}; + +typedef struct Parameters parameters; + +#endif \ No newline at end of file