diff --git a/.gitea/workflows/actions.yaml b/.gitea/workflows/actions.yaml new file mode 100644 index 0000000..ba72228 --- /dev/null +++ b/.gitea/workflows/actions.yaml @@ -0,0 +1,72 @@ +name: Prepare Build and Testing executable binary +run-name: ${{ gitea.actor }} +on: [push] + +jobs: + Prepare-Build-Testing-With-Make: + runs-on: alpine-sdk + steps: + - name: prepare-container + run: | + echo "83.172.39.220 gitea.home.com" >> /etc/hosts + - name: Check out repository code + uses: actions/checkout@v3 + - name: Building binary with make + run: | + make -j$(nproc) + - name: Testing to run binary builded with make + run: ./tte --version + + Prepare-Build-Testing-With-CMake: + runs-on: alpine-sdk + steps: + - name: prepare-container + run: | + echo "83.172.39.220 gitea.home.com" >> /etc/hosts && \ + apk add cmake + - name: Check out repository code + uses: actions/checkout@v3 + - name: Building binary with CMake + run: | + mkdir build && \ + cd build && \ + cmake .. && \ + make -j$(nproc) + - name: Testing to run binary builded with CMake + run: ./build/tte --version + + Prepare-Build-Testing-With-Meson: + runs-on: alpine-sdk + steps: + - name: prepare-container + run: | + echo "83.172.39.220 gitea.home.com" >> /etc/hosts && \ + apk add meson ninja cmake + - name: Check out repository code + uses: actions/checkout@v3 + - name: Building binary with meson + run: | + meson setup build && \ + ninja -C build + - name: Testing to run binary builded with meson + run: ./build/tte --version + + Archlinux-package: + runs-on: archlinux-aarch64 + steps: + - name: Download PKGBUILD file + run: | + mkdir workspace && \ + cd workspace && \ + curl \ + https://gitea.home.com:3000/TolaMironcenko/tte/raw/branch/main/PKGBUILD \ + -o PKGBUILD && \ + sed "s/arch=('x86_64')/arch=('aarch64')/" -i PKGBUILD + - name: Build package + run: cd workspace && makepkg -f + - name: Push package + run: | + cd workspace && \ + curl --user TolaMironcenko:d57cf51c49b425b42148e5a56882f8330bde011c \ + --upload-file ./tte-git-1.0-1-aarch64.pkg.tar.xz \ + https://gitea.home.com:3000/api/packages/TolaMironcenko/arch/home \ No newline at end of file diff --git a/.gitignore b/.gitignore index f8a3e1a..a190993 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ tte +build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..59e9aa1 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required (VERSION 2.6) +project(tte) +set(CMAKE_C_FLAGS "-std=c99") + +add_executable( + tte + tte.c +) + +install(TARGETS tte DESTINATION /usr/bin) \ No newline at end of file diff --git a/Makefile b/Makefile index b15dcfb..fff26bd 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +DESTDIR=/ + tte: tte.c $(CC) tte.c -o tte -std=c99 @@ -5,5 +7,7 @@ debug: tte.c $(CC) tte.c -o tte -Wall -Wextra -pedantic -std=c99 -g install: tte - sudo cp tte /usr/local/bin/ - sudo chmod +x /usr/local/bin/ + sudo cp tte $(DESTDIR)/usr/bin/ + +uninstall: + sudo rm -v /usr/bin/tte diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..0e8fa4a --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,24 @@ +# Maintainer: Tola Mironcenko +pkgname=tte-git +_pkgname="${pkgname%-git}" +_reponame=tte +pkgver=0.1.1 +pkgrel=1 +pkgdesc="Tiny Text Editor" +arch=('x86_64') +url="https://gitea.home.com:3000/TolaMironcenko/tte" +conflicts=("$_pkgname") +license=('GPL') +source=("git+$url.git") +cksums=('SKIP') + +build() { + cd $_reponame + make +} + +package() { + cd $_reponame + mkdir -p $pkgdir/usr/bin + make DESTDIR="$pkgdir" install +} diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..8e667c9 --- /dev/null +++ b/meson.build @@ -0,0 +1,5 @@ +project('tte', 'c', default_options : ['c_std=c99']) +executable( + 'tte', + 'tte.c' +) diff --git a/tte.c b/tte.c index 0491a7c..e69716e 100644 --- a/tte.c +++ b/tte.c @@ -175,7 +175,7 @@ typedef enum ActionType ActionType; char* C_HL_extensions[] = {".c", ".h", ".cpp", ".hpp", ".cc", NULL}; // Array must be terminated with NULL. char* JAVA_HL_extensions[] = {".java", NULL}; char* PYTHON_HL_extensions[] = {".py",".pyw",".py3",".pyc",".pyo", NULL}; -char* BASH_HL_extensions[] = {".sh", NULL}; +char* BASH_HL_extensions[] = {".sh", ".bash", ".zsh", NULL}; char* JS_HL_extensions[] = {".js", ".jsx", NULL}; char* PHP_HL_extensions[] = {".php",".phtml", NULL}; char* JSON_HL_extensions[] = {".json", ".jsonp", NULL}; @@ -2082,7 +2082,6 @@ void initEditor() { ec.syntax = NULL; ec.actions = actionListInit(); - editorUpdateWindowSize(); // The SIGWINCH signal is sent to a process when its controlling // terminal changes its size (a window change). signal(SIGWINCH, editorHandleSigwinch); @@ -2155,6 +2154,7 @@ int main(int argc, char* argv[]) { editorOpen(argv[argc - 1]); else if (arg_response == -1) return 0; + editorUpdateWindowSize(); enableRawMode(); editorSetStatusMessage(" Ctrl-Q to quit | Ctrl-S to save | (tte -h | --help for more info)");