diff --git a/Makefile b/Makefile index 4af5ae3..9e87fc8 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ CC = gcc CFLAGS = -Wall -Wextra -O2 PREFIX = /usr/local +VERSION = 1.0.1 # Files PROG = shardz @@ -17,9 +18,15 @@ $(PROG): $(OBJECTS) install: $(PROG) install -d $(DESTDIR)$(PREFIX)/bin install -m 755 $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG) + install -d $(DESTDIR)$(PREFIX)/lib/pkgconfig + install -m 644 shardz.pc $(DESTDIR)$(PREFIX)/lib/pkgconfig/ + install -d $(DESTDIR)$(PREFIX)/share/man/man1 + install -m 644 man/shardz.1 $(DESTDIR)$(PREFIX)/share/man/man1/ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/$(PROG) + rm -f $(DESTDIR)$(PREFIX)/lib/pkgconfig/shardz.pc + rm -f $(DESTDIR)$(PREFIX)/share/man/man1/shardz.1 clean: rm -f $(PROG) $(OBJECTS) diff --git a/man/shardz.1 b/man/shardz.1 new file mode 100644 index 0000000..8a4202d --- /dev/null +++ b/man/shardz.1 @@ -0,0 +1,35 @@ +.TH SHARDZ 1 "2025" "shardz 1.0.1" "User Commands" +.SH NAME +shardz \- shard the output of any process for distributed processing +.SH SYNOPSIS +.B some_command +.RI "|" +.B shardz +.I INDEX/TOTAL +.SH DESCRIPTION +.B shardz +is a lightweight utility that shards (splits) the output of any process for distributed processing. +It allows you to easily distribute workloads across multiple processes or machines by splitting +input streams into evenly distributed chunks. +.SH OPTIONS +.TP +.I INDEX/TOTAL +INDEX is the shard number (starting from 1), and TOTAL is the total number of shards. +.SH EXAMPLES +Machine number 1 would run: +.PP +.nf +curl https://example.com/large_file.txt | shardz 1/3 +.fi +.PP +Machine number 2 would run: +.PP +.nf +curl https://example.com/large_file.txt | shardz 2/3 +.fi +.SH AUTHOR +Written by acidvegas +.SH COPYRIGHT +Copyright \(co 2025 acidvegas +.br +Licensed under the ISC License. \ No newline at end of file diff --git a/pkg/arch/PKGBUILD b/pkg/arch/PKGBUILD new file mode 100644 index 0000000..358ad35 --- /dev/null +++ b/pkg/arch/PKGBUILD @@ -0,0 +1,23 @@ +# Maintainer: acidvegas + +pkgname=shardz +pkgver=1.0.0 +pkgrel=1 +pkgdesc="Utility that shards the output of any process for distributed processing" +arch=('x86_64' 'i686' 'aarch64' 'armv7h') +url="https://github.com/acidvegas/shardz" +license=('ISC') +depends=('glibc') +source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz") +sha256sums=('SKIP') + +build() { + cd "$pkgname-$pkgver" + make +} + +package() { + cd "$pkgname-$pkgver" + make DESTDIR="$pkgdir" PREFIX=/usr install + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} \ No newline at end of file diff --git a/pkg/debian/control b/pkg/debian/control new file mode 100644 index 0000000..a61fb60 --- /dev/null +++ b/pkg/debian/control @@ -0,0 +1,16 @@ +Source: shardz +Section: utils +Priority: optional +Maintainer: acidvegas +Build-Depends: debhelper-compat (= 13), gcc, make +Standards-Version: 4.5.1 +Homepage: https://github.com/acidvegas/shardz + +Package: shardz +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Utility that shards process output for distributed processing + Shardz is a lightweight C utility that shards (splits) the output of any + process for distributed processing. It allows you to easily distribute + workloads across multiple processes or machines by splitting input streams + into evenly distributed chunks. \ No newline at end of file diff --git a/pkg/debian/rules b/pkg/debian/rules new file mode 100644 index 0000000..2c1254b --- /dev/null +++ b/pkg/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_auto_install: + dh_auto_install -- PREFIX=/usr \ No newline at end of file diff --git a/pkg/rpm/shardz.spec b/pkg/rpm/shardz.spec new file mode 100644 index 0000000..0b4ec3d --- /dev/null +++ b/pkg/rpm/shardz.spec @@ -0,0 +1,35 @@ +Name: shardz +Version: 1.0.1 +Release: 1%{?dist} +Summary: Utility that shards the output of any process for distributed processing + +License: ISC +URL: https://github.com/acidvegas/shardz +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +BuildRequires: gcc +BuildRequires: make + +%description +Shardz is a lightweight C utility that shards (splits) the output of any process +for distributed processing. It allows you to easily distribute workloads across +multiple processes or machines by splitting input streams into evenly distributed chunks. + +%prep +%autosetup + +%build +%make_build + +%install +%make_install + +%files +%license LICENSE +%{_bindir}/shardz +%{_mandir}/man1/shardz.1* +%{_libdir}/pkgconfig/shardz.pc + +%changelog +* Wed Dec 07 2024 acidvegas - 1.0.1 +- Initial package \ No newline at end of file diff --git a/shardz.pc b/shardz.pc new file mode 100644 index 0000000..fd74829 --- /dev/null +++ b/shardz.pc @@ -0,0 +1,7 @@ +prefix=/usr/local +exec_prefix=${prefix} +bindir=${exec_prefix}/bin + +Name: shardz +Description: Utility that shards the output of any process for distributed processing +Version: 1.0.1