From 20f8d5bf050a397cdd9063ec96ca2907350a04ab Mon Sep 17 00:00:00 2001
From: Vittorio Giovara <vittorio.giovara@savoirfairelinux.com>
Date: Mon, 5 May 2014 18:23:36 -0400
Subject: [PATCH] contrib: add gsm rules and patches

Based on VideoLan code by Jean-Baptiste Kempf et al.
Refs: #46617

Change-Id: I32b34e06ba91999d9e978f0cf1728bebacbdb9b0
---
 contrib/src/gsm/SHA512SUMS      |  1 +
 contrib/src/gsm/gsm-cross.patch | 38 +++++++++++++++++++++++++++++++++
 contrib/src/gsm/rules.mak       | 24 +++++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 contrib/src/gsm/SHA512SUMS
 create mode 100644 contrib/src/gsm/gsm-cross.patch
 create mode 100644 contrib/src/gsm/rules.mak

diff --git a/contrib/src/gsm/SHA512SUMS b/contrib/src/gsm/SHA512SUMS
new file mode 100644
index 0000000000..0aed31f5c4
--- /dev/null
+++ b/contrib/src/gsm/SHA512SUMS
@@ -0,0 +1 @@
+0d0cf9e1e81e64cd84f588c1e4f0cb74b849d45e41fdebf860f63588084c73c7c5198bfe73a6c976bda5735ee516661d3db00afbb5cc5886a7ee3a7b31d673aa  libgsm_1.0.13.tar.gz
diff --git a/contrib/src/gsm/gsm-cross.patch b/contrib/src/gsm/gsm-cross.patch
new file mode 100644
index 0000000000..1b8d6e2576
--- /dev/null
+++ b/contrib/src/gsm/gsm-cross.patch
@@ -0,0 +1,38 @@
+diff -ruN gsm/Makefile gsm.new/Makefile
+--- gsm/Makefile	2006-04-26 21:14:26.000000000 +0200
++++ gsm.new/Makefile	2009-03-29 20:12:39.000000000 +0200
+@@ -43,10 +43,8 @@
+ # CC		= /usr/lang/acc
+ # CCFLAGS 	= -c -O
+ 
+-CC		= gcc -ansi -pedantic
+ CCFLAGS 	= -c -O2 -DNeedFunctionPrototypes=1
+ 
+-LD 		= $(CC)
+ 
+ # LD		= gcc
+ # LDFLAGS 	=
+@@ -98,14 +96,11 @@
+ SHELL		= /bin/sh
+ LN		= ln
+ BASENAME 	= basename
+-AR		= ar
+ ARFLAGS		= cr
+ RMFLAGS		=
+ FIND		= find
+ COMPRESS 	= compress
+ COMPRESSFLAGS 	= 
+-# RANLIB 	= true
+-RANLIB	 	= ranlib
+ 
+ #
+ #    You shouldn't have to configure below this line if you're porting.
+@@ -279,7 +274,7 @@
+ 
+ # Target rules
+ 
+-all:		$(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
++all:		$(LIBGSM)
+ 		@-echo $(ROOT): Done.
+ 
+ tst:		$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
diff --git a/contrib/src/gsm/rules.mak b/contrib/src/gsm/rules.mak
new file mode 100644
index 0000000000..2ca2b440f2
--- /dev/null
+++ b/contrib/src/gsm/rules.mak
@@ -0,0 +1,24 @@
+# GSM
+GSM_VERSION := 1.0.13
+GSM_URL := $(CONTRIB_VIDEOLAN)/libgsm_$(GSM_VERSION).tar.gz
+
+PKGS += gsm
+
+$(TARBALLS)/libgsm_$(GSM_VERSION).tar.gz:
+	$(call download,$(GSM_URL))
+
+.sum-gsm: libgsm_$(GSM_VERSION).tar.gz
+
+gsm: libgsm_$(GSM_VERSION).tar.gz .sum-gsm
+	$(UNPACK)
+	mv gsm-1.0-* libgsm_$(GSM_VERSION)
+	$(APPLY) $(SRC)/gsm/gsm-cross.patch
+	sed -e 's/^CFLAGS.*=/CFLAGS+=/' -i.orig libgsm_$(GSM_VERSION)/Makefile
+	$(MOVE)
+
+.gsm: gsm
+	cd $< && $(HOSTVARS) $(MAKE)
+	mkdir -p "$(PREFIX)/include/gsm" "$(PREFIX)/lib"
+	cp $</inc/gsm.h "$(PREFIX)/include/gsm/"
+	cp $</lib/libgsm.a "$(PREFIX)/lib/"
+	touch $@
-- 
GitLab