Commit 31733045 authored by Roman Alifanov's avatar Roman Alifanov Committed by Roman Alifanov

Add Meson build system, RPM spec, gear rules

parent fc7a945f
tar: .
\ No newline at end of file
......@@ -1312,6 +1312,23 @@ is_empty (value)
---
## Сборка и установка
### Meson
```bash
meson setup builddir
meson test -C builddir # pytest
sudo meson install -C builddir
```
Устанавливается:
- `/usr/bin/content` — CLI
- `/usr/share/content/bootstrap/` — компилятор
- `/usr/share/content/lib/cli.ct` — стандартная библиотека
---
## CLI
### build
......
......@@ -26,6 +26,8 @@
## Installation
### From source (development)
```bash
git clone https://gitlab.eterfund.ru/ximperlinux/ContenT.git
cd content
......@@ -33,17 +35,30 @@ cd content
Requires Python 3.8+ (bootstrap compiler).
### System-wide (Meson)
```bash
meson setup builddir
meson test -C builddir
sudo meson install -C builddir
```
Installs:
- `/usr/bin/content` — CLI entry point
- `/usr/share/content/bootstrap/` — compiler (Python)
- `/usr/share/content/lib/cli.ct` — standard library
## Quick Start
```bash
# Compile .ct to .sh
python3 content build main.ct
content build main.ct
# Compile and run
python3 content run main.ct
content run main.ct
# Compile with linting (ShellCheck)
python3 content build main.ct --lint
content build main.ct --lint
```
## Syntax Overview
......
......@@ -26,6 +26,8 @@
## Установка
### Из исходников (разработка)
```bash
git clone https://gitlab.eterfund.ru/ximperlinux/ContenT.git
cd content
......@@ -33,17 +35,30 @@ cd content
Требуется Python 3.8+ (bootstrap-компилятор).
### Системная установка (Meson)
```bash
meson setup builddir
meson test -C builddir
sudo meson install -C builddir
```
Устанавливается:
- `/usr/bin/content` — CLI точка входа
- `/usr/share/content/bootstrap/` — компилятор (Python)
- `/usr/share/content/lib/cli.ct` — стандартная библиотека
## Быстрый старт
```bash
# Компиляция .ct в .sh
python3 content build main.ct
content build main.ct
# Компиляция и запуск
python3 content run main.ct
content run main.ct
# Компиляция с линтингом (ShellCheck)
python3 content build main.ct --lint
content build main.ct --lint
```
## Обзор синтаксиса
......
conf = configuration_data()
conf.set('PYTHON', py.full_path())
conf.set('pkgdatadir', pkgdatadir)
configure_file(
input: '../content.in',
output: 'content',
configuration: conf,
install: true,
install_dir: get_option('bindir'),
install_mode: 'r-xr-xr-x',
)
bootstrap_sources = [
'__init__.py',
'ast_nodes.py',
'awk_codegen.py',
'class_codegen.py',
'codegen.py',
'constants.py',
'cse_codegen.py',
'dce.py',
'decorator_codegen.py',
'dispatch_codegen.py',
'errors.py',
'expr_codegen.py',
'lexer.py',
'main.py',
'parser.py',
'stdlib.py',
'stmt_codegen.py',
'tokens.py',
]
install_data(bootstrap_sources,
install_dir: pkgdatadir / 'bootstrap')
methods_sources = [
'methods/__init__.py',
'methods/args.py',
'methods/array.py',
'methods/base.py',
'methods/core.py',
'methods/dict.py',
'methods/file_handle.py',
'methods/fs.py',
'methods/http.py',
'methods/json.py',
'methods/logger.py',
'methods/math.py',
'methods/process_handle.py',
'methods/reflect.py',
'methods/regex.py',
'methods/string.py',
'methods/time.py',
]
install_data(methods_sources,
install_dir: pkgdatadir / 'bootstrap' / 'methods')
#!@PYTHON@
import sys
sys.path.insert(0, '@pkgdatadir@')
from bootstrap.main import main
if __name__ == "__main__":
sys.exit(main())
Name: content
Version: 0.1.0
Release: alt1
License: AGPL-3.0+
Summary: ContenT DSL compiler - compiles .ct to optimized Bash scripts
Group: Development/Tools
Url: https://gitlab.eterfund.ru/ximperlinux/ContenT
BuildArch: noarch
Source: %name-%version.tar
BuildRequires(pre): rpm-macros-meson
BuildRequires(pre): rpm-build-python3
BuildRequires: meson
BuildRequires: python3
BuildRequires: python3-module-pytest
BuildRequires: jq
BuildRequires: curl
AutoProv:no
%add_python3_path %_datadir/content
%description
ContenT is a DSL compiler that transforms .ct files into optimized Bash scripts.
The syntax is a hybrid of Python, Go and Vala.
%prep
%setup
%build
%meson
%meson_build
%install
%meson_install
%check
%meson_test
%files
%_bindir/content
%_datadir/content/
%doc README.md README_ru.md LANGUAGE_SPEC.md
%changelog
* Thu Feb 20 2026 Roman Alifanov <ximper@altlinux.org> 0.1.0-alt1
- initial build
install_data('cli.ct',
install_dir: pkgdatadir / 'lib')
project('content',
version: '0.1.0',
meson_version: '>= 0.59.0',
)
python = import('python')
py = python.find_installation('python3')
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
subdir('bootstrap')
subdir('lib')
test('pytest', py,
args: ['-m', 'pytest', 'tests/', '-v'],
workdir: meson.project_source_root(),
timeout: 120)
......@@ -50,7 +50,9 @@ print ("killed")
def test_async_read(self):
code, stdout, _ = run_ct('''
proc = async echo ("hello output")
proc = async cat ()
proc.write ("hello output")
proc.close ()
line = proc.read ()
print ("got:{line}")
await proc
......
......@@ -36,7 +36,7 @@ home = env.HOME
print (home)
''')
assert code == 0
assert "/home" in stdout or "/Users" in stdout or "/root" in stdout
assert stdout.strip().startswith("/")
def test_env_user(self):
code, stdout, _ = run_ct('''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment