Skip to content
Permalink
Browse files

libgsm 1.0.18: new port

library and tools to convert to/from gsm audio format
  • Loading branch information
kencu committed Apr 11, 2019
1 parent 767dc39 commit be79f81beda6e90e0f08364f8f3ad4b888f31e9d
Showing with 169 additions and 0 deletions.
  1. +65 −0 audio/libgsm/Portfile
  2. +31 −0 audio/libgsm/files/patch-makefile-more.diff
  3. +73 −0 audio/libgsm/files/patch-makefile.diff
@@ -0,0 +1,65 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0

name libgsm
version 1.0.18
license public-domain

categories audio
maintainers nonmaintainer
description library and tools to convert to/frm gsm audio format
long_description ${description}

homepage http://www.quut.com/gsm
platforms darwin
distname gsm-${version}
master_sites http://www.quut.com/gsm/
checksums rmd160 e268a667257aa42d5ddbb76c9a8b519f0a7cdb2d \
sha256 04f68087c3348bf156b78d59f4d8aff545da7f6e14f33be8f47d33f4efae2a10 \
size 64549

worksrcdir gsm-1.0-pl18
use_configure no

patch.pre_args -p1
patchfiles patch-makefile.diff patch-makefile-more.diff

variant universal {}
use_parallel_build no

if {[vercmp [macports_version] 2.5.99] >= 0} {
build.args "CC=${configure.cc} [get_canonical_archflags cc]"
} else {
build.args CC="${configure.cc} [get_canonical_archflags cc]"
}

destroot.env INSTALL_ROOT=${destroot}${prefix}

post-destroot {
move ${worksrcpath}/lib/libgsm.1.0.13.dylib ${destroot}${prefix}/lib
move ${worksrcpath}/lib/libgsm.1.dylib ${destroot}${prefix}/lib
move ${worksrcpath}/lib/libgsm.dylib ${destroot}${prefix}/lib

system -W ${destroot}${prefix} \
"install_name_tool -change ./lib/libgsm.1.0.13.dylib ${prefix}/lib/libgsm.1.0.13.dylib ./lib/libgsm.1.0.13.dylib"
system -W ${destroot}${prefix} \
"install_name_tool -change ./lib/libgsm.1.0.13.dylib ${prefix}/lib/libgsm.1.0.13.dylib ./bin/tcat"
system -W ${destroot}${prefix} \
"install_name_tool -change ./lib/libgsm.1.0.13.dylib ${prefix}/lib/libgsm.1.0.13.dylib ./bin/toast"
system -W ${destroot}${prefix} \
"install_name_tool -change ./lib/libgsm.1.0.13.dylib ${prefix}/lib/libgsm.1.0.13.dylib ./bin/untoast"

This comment has been minimized.

Copy link
@ryandesign

ryandesign Apr 11, 2019

Contributor

How did you decide to use this library version number?

If there's an upstream ticket tracking implementing macOS dynamic libraries in the proper way, please add a comment to the Portfile with its URL.

This comment has been minimized.

Copy link
@kencu

kencu Apr 11, 2019

Author Contributor

Upstream is pretty quiet. I saw no bugreporter or ticketing system or cms repo. The modifications to enable the shared library version are all from the various package mgmt systems, and each has their slightly different implementation https://src.fedoraproject.org/rpms/gsm/blob/master/f/gsm-makefile.patch.

This numbering system matches the one currently used on macOS by homebrew, https://github.com/Homebrew/homebrew-core/blob/master/Formula/libgsm.rb which has had this formulae in for a while, so on the off chance there is software built against the specific versioned libgsm on macOS, it would likely be using this numbering system at present.

But it would be correct to say that 1.0.18 would better match the version in the source, rather than in common use. The macOS dylib-enabling patchfile I culled from the net would need to be updated to that number. I have no complaints with that -- I left this a nomaintainer as I expect it to be updated about once a decade or so ...


}

# this is only a partial test of the software's adding algorithm
#test.run yes
#test.target addtst
#test.args ${build.args}

# to test the encoding and decoding, see <https://ccrma.stanford.edu/~fujishim/199/gsm_survey.html>
# to convert samples to gsm for testing, see <https://convertio.co/wav-gsm/>

livecheck.type regex
livecheck.url ${master_sites}
livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)
@@ -0,0 +1,31 @@
--- a/Makefile.orig 2019-04-11 11:37:20.000000000 -0700
+++ b/Makefile 2019-04-11 11:37:53.000000000 -0700
@@ -71,7 +71,7 @@
# Leave INSTALL_ROOT empty (or just don't execute "make install") to
# not install gsm and toast outside of this directory.

-INSTALL_ROOT =
+INSTALL_ROOT ?=

# Where do you want to install the gsm library, header file, and manpages?
#
@@ -80,8 +80,8 @@

GSM_INSTALL_ROOT = $(INSTALL_ROOT)
GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
-GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
-GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
+GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
+GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3


# Where do you want to install the toast binaries and their manpage?
@@ -91,7 +91,7 @@

TOAST_INSTALL_ROOT = $(INSTALL_ROOT)
TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
-TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
+TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1

# Other tools

@@ -0,0 +1,73 @@
From: <jochen@scram.de>
Subject: New patch generated from libgsm 1.0.10-14 diff.gz

diff -urNad libgsm-1.0.12~/Makefile libgsm-1.0.12/Makefile
--- libgsm-1.0.12~/Makefile 2007-11-01 15:37:52.000000000 +0100
+++ libgsm-1.0.12/Makefile 2007-11-01 15:43:06.000000000 +0100
@@ -96,7 +96,7 @@
# Other tools

SHELL = /bin/sh
-LN = ln
+LN = ln -s
BASENAME = basename
AR = ar
ARFLAGS = cr
@@ -140,6 +140,7 @@
# Targets

LIBGSM = $(LIB)/libgsm.a
+LIBGSMSO= $(LIB)/libgsm.1.0.13.dylib

TOAST = $(BIN)/toast
UNTOAST = $(BIN)/untoast
@@ -279,7 +280,7 @@

# Target rules

-all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all: $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
@-echo $(ROOT): Done.

tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -299,6 +300,11 @@

# The basic API: libgsm

+$(LIBGSMSO): $(LIB) $(GSM_OBJECTS)
+ $(LD) -o $(LIBGSMSO) -dynamiclib -Wl,-compatibility_version,1,-current_version,1.0.13,-install_name,$(LIBGSMSO) $(GSM_OBJECTS) -lc
+ ln -fs libgsm.1.0.13.dylib lib/libgsm.1.dylib
+ ln -fs libgsm.1.0.13.dylib lib/libgsm.dylib
+
$(LIBGSM): $(LIB) $(GSM_OBJECTS)
-rm $(RMFLAGS) $(LIBGSM)
$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
@@ -308,15 +314,15 @@
# Toast, Untoast and Tcat -- the compress-like frontends to gsm.

$(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
- $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
+ $(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
@@ -426,7 +432,9 @@

clean: semi-clean
-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \
- $(TOAST) $(TCAT) $(UNTOAST) \
+ $(LIBGSMSO) $(LIB)/libgsm.1.dylib \
+ $(LIB)/libgsm.dylib \
+ $(TOAST) $(TCAT) $(UNTOAST) \
$(ROOT)/gsm-1.0.tar.Z

0 comments on commit be79f81

Please sign in to comment.
You can’t perform that action at this time.