diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7fd9f61
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+SOURCES/gsm-1.0.17.tar.gz
diff --git a/.gsm.metadata b/.gsm.metadata
new file mode 100644
index 0000000..041fde0
--- /dev/null
+++ b/.gsm.metadata
@@ -0,0 +1 @@
+e8809962a33275a60b05ed04ca3c2395bb375a22 SOURCES/gsm-1.0.17.tar.gz
diff --git a/SOURCES/gsm-makefile.patch b/SOURCES/gsm-makefile.patch
new file mode 100644
index 0000000..8153480
--- /dev/null
+++ b/SOURCES/gsm-makefile.patch
@@ -0,0 +1,185 @@
+diff -up gsm-1.0-pl17/Makefile.mk gsm-1.0-pl17/Makefile
+--- gsm-1.0-pl17/Makefile.mk	2017-06-28 02:24:24.000000000 +0200
++++ gsm-1.0-pl17/Makefile	2017-06-29 13:18:44.138719902 +0200
+@@ -44,13 +44,17 @@ WAV49	= -DWAV49
+ # CCFLAGS 	= -c -O
+ 
+ CC		= gcc -ansi -pedantic
+-CCFLAGS 	= -c -O2 -DNeedFunctionPrototypes=1 -Wall -Wno-comment
++CCFLAGS 	= -c $(RPM_OPT_FLAGS) -DNeedFunctionPrototypes=1 -Wall -Wno-comment -D_XOPEN_SOURCE=700 -D_REENTRANT -fPIC
+ 
+ LD 		= $(CC)
+ 
+ # LD		= gcc
+ # LDFLAGS 	=
+ 
++SO_MAJOR = 1
++SO_MINOR = 0
++SO_MICRO = 17
++SO_VER = $(SO_MAJOR).$(SO_MINOR).$(SO_MICRO)
+ 
+ # If your compiler needs additional flags/libraries, regardless of
+ # the source compiled, configure them here.
+@@ -81,7 +85,7 @@ INSTALL_ROOT	=
+ 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_MAN = $(GSM_INSTALL_ROOT)/share/man/man3
+ 
+ 
+ # Where do you want to install the toast binaries and their manpage?
+@@ -91,16 +95,16 @@ GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/ma
+ 
+ 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
+ 
+ SHELL		= /bin/sh
+-LN		= ln
++LN		= ln -s
+ BASENAME 	= basename
+ AR		= ar
+ ARFLAGS		= cr
+-RMFLAGS		=
++RMFLAGS		= -f
+ FIND		= find
+ COMPRESS 	= compress
+ COMPRESSFLAGS 	= 
+@@ -140,6 +144,7 @@ LFLAGS	= $(LDFLAGS) $(LDINC)
+ # Targets
+ 
+ LIBGSM	= $(LIB)/libgsm.a
++LIBGSMSO = $(LIB)/libgsm.so
+ 
+ TOAST	= $(BIN)/toast
+ UNTOAST	= $(BIN)/untoast
+@@ -257,7 +262,9 @@ STUFF = 	ChangeLog			\
+ # Install targets
+ 
+ GSM_INSTALL_TARGETS =	\
+-		$(GSM_INSTALL_LIB)/libgsm.a		\
++		$(GSM_INSTALL_LIB)/libgsm.so.$(SO_VER)	\
++		$(GSM_INSTALL_LIB)/libgsm.so.$(SO_MAJOR)\
++		$(GSM_INSTALL_LIB)/libgsm.so		\
+ 		$(GSM_INSTALL_INC)/gsm.h		\
+ 		$(GSM_INSTALL_MAN)/gsm.3		\
+ 		$(GSM_INSTALL_MAN)/gsm_explode.3	\
+@@ -279,7 +286,7 @@ TOAST_INSTALL_TARGETS =	\
+ 
+ # 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 +306,32 @@ install:	toastinstall gsminstall
+ 
+ # The basic API: libgsm
+ 
++$(LIBGSMSO).$(SO_VER): $(LIB) $(GSM_OBJECTS)
++		$(LD) $(LFLAGS) -o $@ -shared -Xlinker -soname -Xlinker libgsm.so.$(SO_MAJOR) $(GSM_OBJECTS) -lc
++
++$(LIBGSMSO).$(SO_MAJOR): $(LIBGSMSO).$(SO_VER)
++		ln -fs libgsm.so.$(SO_VER) lib/libgsm.so.$(SO_MAJOR)
++
++$(LIBGSMSO): $(LIBGSMSO).$(SO_VER)
++		ln -fs libgsm.so.$(SO_VER) lib/libgsm.so
++
+ $(LIBGSM):	$(LIB) $(GSM_OBJECTS)
+ 		-rm $(RMFLAGS) $(LIBGSM)
+ 		$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
+ 		$(RANLIB) $(LIBGSM)
+ 
+-
+ # 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
+@@ -352,8 +367,7 @@ toastuninstall:
+ 
+ $(TOAST_INSTALL_BIN)/toast:	$(TOAST)
+ 		-rm $@
+-		cp $(TOAST) $@
+-		chmod 755 $@
++		install -pm755 $(TOAST) $@
+ 
+ $(TOAST_INSTALL_BIN)/untoast:	$(TOAST_INSTALL_BIN)/toast
+ 		-rm $@
+@@ -365,39 +379,43 @@ $(TOAST_INSTALL_BIN)/tcat:	$(TOAST_INSTA
+ 
+ $(TOAST_INSTALL_MAN)/toast.1:	$(MAN)/toast.1
+ 		-rm $@
+-		cp $? $@
+-		chmod 444 $@
++		install -pm644 $? $@
+ 
+ $(GSM_INSTALL_MAN)/gsm.3:	$(MAN)/gsm.3
+ 		-rm $@
+-		cp $? $@
+-		chmod 444 $@
++		install -pm644 $? $@
+ 
+ $(GSM_INSTALL_MAN)/gsm_option.3:	$(MAN)/gsm_option.3
+ 		-rm $@
+-		cp $? $@
+-		chmod 444 $@
++		install -pm644 $? $@
+ 
+ $(GSM_INSTALL_MAN)/gsm_explode.3:	$(MAN)/gsm_explode.3
+ 		-rm $@
+-		cp $? $@
+-		chmod 444 $@
++		install -pm644 $? $@
+ 
+ $(GSM_INSTALL_MAN)/gsm_print.3:	$(MAN)/gsm_print.3
+ 		-rm $@
+-		cp $? $@
+-		chmod 444 $@
++		install -pm644 $? $@
+ 
+ $(GSM_INSTALL_INC)/gsm.h:	$(INC)/gsm.h
+ 		-rm $@
+-		cp $? $@
+-		chmod 444 $@
++		install -pm644 $? $@
+ 
+ $(GSM_INSTALL_LIB)/libgsm.a:	$(LIBGSM)
+ 		-rm $@
+-		cp $? $@
+-		chmod 444 $@
++		install -pm644 $? $@
+ 
++$(GSM_INSTALL_LIB)/libgsm.so.$(SO_VER):	$(LIBGSMSO).$(SO_VER)
++		-rm $@
++		install -pm755 $? $@
++
++$(GSM_INSTALL_LIB)/libgsm.so.$(SO_MAJOR):	$(LIBGSMSO).$(SO_MAJOR)
++		-rm $@
++		ln -s libgsm.so.$(SO_VER) $@
++
++$(GSM_INSTALL_LIB)/libgsm.so:	$(LIBGSMSO)
++		-rm $@
++		ln -s libgsm.so.$(SO_VER) $@
+ 
+ # Distribution
+ 
diff --git a/SOURCES/gsm-warnings.patch b/SOURCES/gsm-warnings.patch
new file mode 100644
index 0000000..6399279
--- /dev/null
+++ b/SOURCES/gsm-warnings.patch
@@ -0,0 +1,13 @@
+diff -up gsm-1.0-pl17/src/toast.c.warn gsm-1.0-pl17/src/toast.c
+--- gsm-1.0-pl17/src/toast.c.warn	2017-06-28 02:09:38.000000000 +0200
++++ gsm-1.0-pl17/src/toast.c	2017-06-29 11:44:43.979453734 +0200
+@@ -6,6 +6,9 @@
+ 
+ /* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/toast.c,v 1.8 1996/07/02 10:41:04 jutta Exp $ */
+ 
++#include	<stdio.h>
++#include	<unistd.h>
++#include	<getopt.h>
+ #include	"toast.h"
+ 
+ /*  toast -- lossy sound compression using the gsm library.
diff --git a/SPECS/gsm.spec b/SPECS/gsm.spec
new file mode 100644
index 0000000..2749c27
--- /dev/null
+++ b/SPECS/gsm.spec
@@ -0,0 +1,269 @@
+%global ver_maj 1.0
+%global ver_min 17
+
+Name:           gsm
+Version:        %{ver_maj}.%{ver_min}
+Release:        5%{?dist}
+Summary:        Shared libraries for GSM speech compressor
+
+Group:          System Environment/Libraries
+License:        MIT
+URL:            http://www.quut.com/gsm/
+Source:         http://www.quut.com/gsm/%{name}-%{version}.tar.gz
+Patch0:         %{name}-makefile.patch
+Patch1:         %{name}-warnings.patch
+
+%global srcver %{ver_maj}-pl%{ver_min}
+
+%description
+Contains runtime shared libraries for libgsm, an implementation of
+the European GSM 06.10 provisional standard for full-rate speech
+transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse
+excitation/long term prediction) coding at 13 kbit/s.
+
+GSM 06.10 compresses frames of 162 13-bit samples (8 kHz sampling
+rate, i.e. a frame rate of 50 Hz) into 260 bits; for compatibility
+with typical UNIX applications, our implementation turns frames of 160
+16-bit linear samples into 33-byte frames (1650 Bytes/s).
+The quality of the algorithm is good enough for reliable speaker
+recognition; even music often survives transcoding in recognizable
+form (given the bandwidth limitations of 8 kHz sampling rate).
+
+The interfaces offered are a front end modelled after compress(1), and
+a library API.  Compression and decompression run faster than realtime
+on most SPARCstations.  The implementation has been verified against the
+ETSI standard test patterns.
+
+%package        tools
+Summary:        GSM speech compressor tools
+Group:          Applications/Multimedia
+
+%description    tools
+Contains command line utilities for libgsm, an implementation of
+the European GSM 06.10 provisional standard for full-rate speech
+transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse
+excitation/long term prediction) coding at 13 kbit/s.
+
+%package        devel
+Summary:        Header files and development libraries for libgsm
+Group:          Development/Libraries
+Requires:       %{name}%{_isa} = %{version}-%{release}
+
+%description    devel
+Contains header files and development libraries for libgsm, an
+implementation of the European GSM 06.10 provisional standard for
+full-rate speech transcoding, prI-ETS 300 036, which uses RPE/LTP
+(residual pulse excitation/long term prediction) coding at 13 kbit/s.
+
+%prep
+%setup -n gsm-%{srcver} -q
+%patch0 -p1 -b .mk
+%patch1 -p1 -b .warn
+
+%build
+export LDFLAGS="%{?__global_ldflags}"
+make %{?_smp_mflags} all
+
+%install
+export LDFLAGS="%{?__global_ldflags}"
+mkdir -p %{buildroot}{%{_bindir},%{_includedir}/gsm,%{_libdir},%{_mandir}/{man1,man3}}
+
+make install \
+	INSTALL_ROOT=%{buildroot}%{_prefix} \
+	GSM_INSTALL_INC=%{buildroot}%{_includedir}/gsm \
+	GSM_INSTALL_LIB=%{buildroot}%{_libdir}
+
+# some apps look for this in /usr/include
+ln -s gsm/gsm.h %{buildroot}%{_includedir}
+
+echo ".so toast.1" > %{buildroot}%{_mandir}/man1/tcat.1
+echo ".so toast.1" > %{buildroot}%{_mandir}/man1/untoast.1
+
+%check
+# This is to ensure that the patch creates the proper library version.
+[ -f %{buildroot}%{_libdir}/libgsm.so.%{version} ]
+export LDFLAGS="%{?__global_ldflags}"
+make addtst
+
+%ldconfig_scriptlets
+
+%files
+%license COPYRIGHT
+%doc ChangeLog MACHINES README
+%{_libdir}/libgsm.so.*
+
+%files tools
+%{_bindir}/tcat
+%{_bindir}/toast
+%{_bindir}/untoast
+%{_mandir}/man1/tcat.1*
+%{_mandir}/man1/toast.1*
+%{_mandir}/man1/untoast.1*
+
+%files devel
+%dir %{_includedir}/gsm
+%{_includedir}/gsm/gsm.h
+%{_includedir}/gsm.h
+%{_libdir}/libgsm.so
+%{_mandir}/man3/gsm.3*
+%{_mandir}/man3/gsm_explode.3*
+%{_mandir}/man3/gsm_option.3*
+%{_mandir}/man3/gsm_print.3*
+
+%changelog
+* Wed Mar 07 2018 Dominik Mierzejewski <rpm[AT]greysector.net> 1.0.17-5
+- ensure binaries are linked with Fedora LDFLAGS (#1548532)
+- use ldconfig_scriptlets macro
+- add proper man links for tcat and untoast
+
+* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.17-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
+
+* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.17-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
+
+* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.17-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
+
+* Thu Jun 29 2017 Dominik Mierzejewski <rpm[AT]greysector.net> 1.0.17-1
+- update to 1.0.17 (#1465878)
+- ease future updates by better macro use
+- drop obsolete patch hunks
+- fix missing prototype for fchown warning
+
+* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.16-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
+
+* Thu Nov 24 2016 Dominik Mierzejewski <rpm[AT]greysector.net> 1.0.16-1
+- update to 1.0.16 (#1397242)
+- use license macro
+- drop obsolete stuff and simplify
+
+* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.13-14
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
+
+* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.13-13
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
+
+* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.13-12
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
+
+* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.13-11
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
+
+* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.13-10
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
+
+* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.13-9
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
+
+* Tue Nov 20 2012 Jaroslav Škarvada <jskarvad@redhat.com> - 1.0.13-8
+- Defines changed to globals
+
+* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.13-7
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
+
+* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.13-6
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
+
+* Wed Nov 30 2011 Jaroslav Škarvada <jskarvad@redhat.com> - 1.0.13-5
+- Fixed build failure, defuzzified gsm-warnings patch
+  Resolves: rhbz#757136
+
+* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.13-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
+
+* Sat Jan 16 2010 Dominik Mierzejewski <rpm[AT]greysector.net> 1.0.13-3
+- update homepage and source URLs
+
+* Wed Jul 29 2009 Jeffrey C. Ollie <jeff@ocjtech.us> - 1.0.13-2
+- Fix dangling symlinks for shared lib, thanks to Lucian Langa for pointing out the issue.
+
+* Tue Jul 28 2009 Jeffrey C. Ollie <jeff@ocjtech.us> - 1.0.13-1.1
+- Upload sources
+
+* Tue Jul 28 2009 Jeffrey C. Ollie <jeff@ocjtech.us> - 1.0.13-1
+- Update to 1.0.13
+
+* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.12-8
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.12-7
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
+* Mon Feb 11 2008 Jeffrey C. Ollie <jeff@ocjtech.us> - 1.0.12-6
+- Rebuild for GCC 4.3
+
+* Sun Aug 26 2007 Dominik Mierzejewski <rpm[AT]greysector.net> 1.0.12-5
+- install symlinks instead of binaries in -devel
+
+* Sat Aug 25 2007 Dominik Mierzejewski <rpm[AT]greysector.net> 1.0.12-4
+- rebuild for BuildID
+- specfile cleanups
+
+* Sun May 13 2007 Dominik Mierzejewski <rpm[AT]greysector.net> 1.0.12-3
+- fix parallel make
+
+* Fri May 11 2007 Dominik Mierzejewski <rpm[AT]greysector.net> 1.0.12-2
+- fix some warnings
+- fix 64bit testsuite issue as described at gsm homepage
+- add compatibility header symlink
+- split off binaries into a separate package
+
+* Sun Apr 15 2007 Michael Schwendt <mschwendt[AT]users.sf.net> 1.0.12-1
+- Update to Release 1.0 Patchlevel 12.
+- Build with -fPIC not just for non-ix86.
+- Add check section to ensure proper library version.
+- Remove static library.
+
+* Fri Oct 06 2006 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> 1.0.10-12
+- rebuilt for unwind info generation, broken in gcc-4.1.1-21
+
+* Tue Sep 26 2006 Thomas Vander Stichele <thomas at apestaart dot org>
+- 1.0.10-11
+- rebuild for FC6
+
+* Thu Mar 09 2006 Andreas Bierfert <andreas.bierfert[AT]lowlatency.de>
+- switch to new release field
+
+* Tue Feb 28 2006 Andreas Bierfert <andreas.bierfert[AT]lowlatency.de>
+- add dist
+
+* Mon Jun 27 2005 David Woodhouse <dwmw2@infradead.org>
+- 1.0.10-0.lvn.10: Clean up installation
+
+* Sat Jun 25 2005 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> 
+- 1.0.10-0.lvn.9: mv libgsm.a only when needed
+
+* Fri Dec 31 2004 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> 
+- 1.0.10-0.lvn.8: Use -fPIC on non ix86
+
+* Tue Mar 02 2004 Thomas Vander Stichele <thomas at apestaart dot org>
+- 1.0.10-0.lvn.7: moved to rpm.livna.org
+
+* Tue Mar 02 2004 Thomas Vander Stichele <thomas at apestaart dot org>
+- 1.0.10-0.fdr.7: applied patch from Ville, remove epoch since it's allowed
+
+* Sat Sep 13 2003 Thomas Vander Stichele <thomas at apestaart dot org>
+- 0:1.0.10-0.fdr.6: remove second makeinstall
+
+* Sun Sep 07 2003 Thomas Vander Stichele <thomas at apestaart dot org>
+- 0:1.0.10-0.fdr.5
+- added back epochs, I surrender
+- fix RPM_OPT_FLAGS hackery
+
+* Fri Jul 18 2003 Thomas Vander Stichele <thomas at apestaart dot org>
+- 1.0.10-0.fdr.4: remove epoch mentions
+
+* Sat Jul 05 2003 Thomas Vander Stichele <thomas at apestaart dot org>
+- 1.0.10-0.fdr.3
+- pull in RPM_OPT_FLAGS in patch instead of using perl to wedge it in
+- fix group
+- -p'ize ldconfig
+
+* Tue Jun 10 2003 Thomas Vander Stichele <thomas at apestaart dot org>
+- 1.0.10-0.fdr.2
+- Fix libgsm.so.* being files instead of symlinks
+
+* Thu May 29 2003 Thomas Vander Stichele <thomas at apestaart dot org>
+- 0:1.0.10-0.fdr.1: initial RPM release