From d652faf3c5be4a10a10f17b51147e6bbd9d01181 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Thu, 18 Jun 2026 10:36:56 +0300 Subject: [PATCH] Initial commit --- .gitignore | 3 + check-version.sh | 14 +++ info.yml | 17 +++ recipe.sh | 33 ++++++ source-files/gsm-fix-toast-install.patch | 16 +++ source-files/gsm-shared.patch | 130 +++++++++++++++++++++++ 6 files changed, 213 insertions(+) create mode 100644 .gitignore create mode 100644 check-version.sh create mode 100644 info.yml create mode 100644 recipe.sh create mode 100644 source-files/gsm-fix-toast-install.patch create mode 100644 source-files/gsm-shared.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d96df7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Ignore BPM archives and signatures +*.bpm +*.bpm.sig diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..227b76a --- /dev/null +++ b/check-version.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +URL="https://www.quut.com/gsm/" + +# Get version number from tag name +VERSION=$(curl -s -L "$URL" | grep -o -P 'gsm-([\d.]+).tar.gz' | head -n1) + +# Trim prefix +VERSION=${VERSION//gsm-/} + +# Trim suffix +VERSION=${VERSION//.tar.gz/} + +echo "$VERSION" diff --git a/info.yml b/info.yml new file mode 100644 index 0000000..ff72c13 --- /dev/null +++ b/info.yml @@ -0,0 +1,17 @@ +name: gsm +description: Shared libraries for GSM 06.10 lossy speech compression +version: 1.0.24 +revision: 1 +url: https://www.quut.com/gsm/ +license: custom +maintainers: + - enumdev@enumerated.dev +architecture: any +type: source +depends: + - glibc +downloads: + - url: https://www.quut.com/gsm/gsm-${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: a3c40c6471928383f4abfcb2e8f24012a1f562be2f17b8d672145d5986681a92 diff --git a/recipe.sh b/recipe.sh new file mode 100644 index 0000000..803bf61 --- /dev/null +++ b/recipe.sh @@ -0,0 +1,33 @@ +# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +# The prepare function is executed in the root of the temp directory +# This function is used for putting downloaded files to the correct location or applying patches +prepare() { + cd "$BPM_SOURCE" + patch -Np0 -i "$BPM_WORKDIR"/gsm-fix-toast-install.patch + patch -Np0 -i "$BPM_WORKDIR"/gsm-shared.patch +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + make CCFLAGS="-c ${CFLAGS} -fPIC" +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + # Prepare directories + install -dm755 "$BPM_OUTPUT"/usr/{bin,lib,include/gsm,share/{licenses/$pkgname,man/man{1,3}}} + + make -j1 INSTALL_ROOT="$BPM_OUTPUT"/usr \ + GSM_INSTALL_INC="$BPM_OUTPUT"/usr/include/gsm \ + GSM_INSTALL_MAN="$BPM_OUTPUT"/usr/share/man/man3 \ + TOAST_INSTALL_MAN="$BPM_OUTPUT"/usr/share/man/man1 \ + install + + # Install package license + install -Dm644 "$BPM_SOURCE"/COPYRIGHT "$BPM_OUTPUT"/usr/share/licenses/gsm/COPYRIGHT +} diff --git a/source-files/gsm-fix-toast-install.patch b/source-files/gsm-fix-toast-install.patch new file mode 100644 index 0000000..d641ac7 --- /dev/null +++ b/source-files/gsm-fix-toast-install.patch @@ -0,0 +1,16 @@ +--- Makefile.orig 2022-08-02 00:11:31.493613903 +0300 ++++ Makefile 2022-08-02 00:11:40.203644903 +0300 +@@ -359,11 +359,11 @@ + + $(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast + -rm $(RMFLAGS) $@ +- $(LN) $? $@ ++ $(LN) toast $@ + + $(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast + -rm $(RMFLAGS) $@ +- $(LN) $? $@ ++ $(LN) toast $@ + + $(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1 + -rm $(RMFLAGS) $@ diff --git a/source-files/gsm-shared.patch b/source-files/gsm-shared.patch new file mode 100644 index 0000000..1e3dfaf --- /dev/null +++ b/source-files/gsm-shared.patch @@ -0,0 +1,130 @@ +--- Makefile 2006-04-26 15:14:26.000000000 -0400 ++++ Makefile 2010-06-19 16:53:25.000000000 -0400 +@@ -96,7 +96,7 @@ + # Other tools + + SHELL = /bin/sh +-LN = ln ++LN = ln -s -f + BASENAME = basename + AR = ar + ARFLAGS = cr +@@ -139,7 +139,7 @@ + + # Targets + +-LIBGSM = $(LIB)/libgsm.a ++LIBGSMSO = $(LIB)/libgsm.so + + TOAST = $(BIN)/toast + UNTOAST = $(BIN)/untoast +@@ -257,7 +257,7 @@ + # Install targets + + GSM_INSTALL_TARGETS = \ +- $(GSM_INSTALL_LIB)/libgsm.a \ ++ $(GSM_INSTALL_LIB)/libgsm.so \ + $(GSM_INSTALL_INC)/gsm.h \ + $(GSM_INSTALL_MAN)/gsm.3 \ + $(GSM_INSTALL_MAN)/gsm_explode.3 \ +@@ -279,7 +279,7 @@ + + # Target rules + +-all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST) ++all: $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST) + @-echo $(ROOT): Done. + + tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result +@@ -299,24 +299,23 @@ + + # The basic API: libgsm + +-$(LIBGSM): $(LIB) $(GSM_OBJECTS) +- -rm $(RMFLAGS) $(LIBGSM) +- $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS) +- $(RANLIB) $(LIBGSM) +- ++$(LIBGSMSO): $(LIB) $(GSM_OBJECTS) ++ $(LD) $(LFLAGS) -shared -Wl,-soname,libgsm.so.1 -o $@.1.0.22 $(GSM_OBJECTS) ++ $(LN) libgsm.so.1.0.22 $(LIBGSMSO).1 ++ $(LN) libgsm.so.1.0.22 $(LIBGSMSO) + + # Toast, Untoast and Tcat -- the compress-like frontends to gsm. + +-$(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM) +- $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB) ++$(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSMSO) ++ $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB) + + $(UNTOAST): $(BIN) $(TOAST) + -rm $(RMFLAGS) $(UNTOAST) +- $(LN) $(TOAST) $(UNTOAST) ++ $(LN) toast $(UNTOAST) + + $(TCAT): $(BIN) $(TOAST) + -rm $(RMFLAGS) $(TCAT) +- $(LN) $(TOAST) $(TCAT) ++ $(LN) toast $(TCAT) + + + # The local bin and lib directories +@@ -351,10 +350,12 @@ + cp $? $@ + chmod 444 $@ + +-$(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM) +- -rm $(RMFLAGS) $@ +- cp $? $@ +- chmod 444 $@ ++$(GSM_INSTALL_LIB)/libgsm.so: $(LIBGSMSO) ++ -rm $(RMFLAGS) $@ $@.1 $@.1.0.22 ++ cp $?.1.0.22 $@.1.0.22 ++ chmod 755 $@.1.0.22 ++ $(LN) libgsm.so.1.0.22 $@ ++ $(LN) libgsm.so.1.0.22 $@.1 + + # Distribution + +@@ -425,7 +425,7 @@ + -print | xargs rm $(RMFLAGS) + + clean: semi-clean +- -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \ ++ -rm $(RMFLAGS) $(LIBGSMSO)* $(ADDTST)/add \ + $(TOAST) $(TCAT) $(UNTOAST) \ + $(ROOT)/gsm-1.0.tar.Z + +@@ -473,22 +473,22 @@ + $(TST)/test-result: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/run + ( cd $(TST); ./run ) + +-$(TST)/lin2txt: $(TST)/lin2txt.o $(LIBGSM) ++$(TST)/lin2txt: $(TST)/lin2txt.o $(LIBGSMSO) + $(LD) $(LFLAGS) -o $(TST)/lin2txt \ +- $(TST)/lin2txt.o $(LIBGSM) $(LDLIB) ++ $(TST)/lin2txt.o $(LIBGSMSO) $(LDLIB) + +-$(TST)/lin2cod: $(TST)/lin2cod.o $(LIBGSM) ++$(TST)/lin2cod: $(TST)/lin2cod.o $(LIBGSMSO) + $(LD) $(LFLAGS) -o $(TST)/lin2cod \ +- $(TST)/lin2cod.o $(LIBGSM) $(LDLIB) ++ $(TST)/lin2cod.o $(LIBGSMSO) $(LDLIB) + +-$(TST)/gsm2cod: $(TST)/gsm2cod.o $(LIBGSM) ++$(TST)/gsm2cod: $(TST)/gsm2cod.o $(LIBGSMSO) + $(LD) $(LFLAGS) -o $(TST)/gsm2cod \ +- $(TST)/gsm2cod.o $(LIBGSM) $(LDLIB) ++ $(TST)/gsm2cod.o $(LIBGSMSO) $(LDLIB) + +-$(TST)/cod2txt: $(TST)/cod2txt.o $(LIBGSM) ++$(TST)/cod2txt: $(TST)/cod2txt.o $(LIBGSMSO) + $(LD) $(LFLAGS) -o $(TST)/cod2txt \ +- $(TST)/cod2txt.o $(LIBGSM) $(LDLIB) ++ $(TST)/cod2txt.o $(LIBGSMSO) $(LDLIB) + +-$(TST)/cod2lin: $(TST)/cod2lin.o $(LIBGSM) ++$(TST)/cod2lin: $(TST)/cod2lin.o $(LIBGSMSO) + $(LD) $(LFLAGS) -o $(TST)/cod2lin \ +- $(TST)/cod2lin.o $(LIBGSM) $(LDLIB) ++ $(TST)/cod2lin.o $(LIBGSMSO) $(LDLIB)