[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#482509: idjc: FTBFS: Nonexistent build-dependency: liblame-dev



tags 482509 +patch
thanks
IMO it is a very bad idea to have a package build against a legally dubious library just because the system it was built on happened to have it installed.

lame itself is not legally dubious, it's just unfortunate in being liable to software patent enforcement on MP3 encoding. That's reason enough not to include lame in Debian, of course.
That is what I meant by legally dubious

It should be possible to build idjc without lame, thereby making it suitable for encoding Ogg Vorbis streams only. It would still be a useful application in that context.
Indeed and I think it is do better than that providing a form of psuedo-mp3 support.

The only change between -3 and -4 was adding liblame-dev | toolame to the build-dependencies.

It seems that the upstream build scripts decide what mp3 encoding options to use based on what is installed.

Previously there were no "mp3" libraries in the build-depends at all meaning the code was built without mp3 support.

Installing toolame does not seem to make any difference (perhaps Free Ekanayaka mixed up toolame and twolame, toolame unlike twolame doesn't seem to provide a liblame equivilent),

Installing libtwolame-dev also does not seem to make any difference to the build

A little more research shows that the twolame api is pretty much the same as the lame api but with all the functions/structures renamed. I have put together a patch that will make the code build with twolame and give an option to encode to mp3 but i do not have an appropriate server handy to test it with. If you accept this patch then the build-depends should be changed to reflect it.

If you do not want to accept my patch (or if you test it and it doesn't work) then I would suggest reverting the build-depends in -4 change which will leave a package that is releasable but lacks mp3 support.
diff -ur idjc-0.7.5/c/live_mp3_encoder.c idjc-0.7.5-new/c/live_mp3_encoder.c
--- idjc-0.7.5/c/live_mp3_encoder.c	2008-04-19 14:52:17.000000000 +0000
+++ idjc-0.7.5-new/c/live_mp3_encoder.c	2008-06-03 19:36:06.000000000 +0000
@@ -124,24 +124,26 @@
          fprintf(stderr, "live_mp3_encoder_main: malloc failure\n");
          goto bailout;
          }
-      if (!(s->gfp = lame_init()))
+      if (!(s->gfp = twolame_init()))
          {
          fprintf(stderr, "live_mp3_encoder_main: failed to initialise LAME\n");
          free(s->mp3buf);
          goto bailout;
          }
-      lame_set_num_channels(s->gfp, encoder->n_channels);
-      lame_set_brate(s->gfp, encoder->bitrate);
-      lame_set_in_samplerate(s->gfp, encoder->target_samplerate);
-      lame_set_out_samplerate(s->gfp, encoder->target_samplerate);
-      lame_set_mode(s->gfp, s->lame_mode);
-      lame_set_quality(s->gfp, s->lame_quality);
-      lame_set_free_format(s->gfp, s->lame_freeformat);
-      lame_set_bWriteVbrTag(s->gfp, 0);
-      if (lame_init_params(s->gfp) < 0)
+      twolame_set_num_channels(s->gfp, encoder->n_channels);
+      twolame_set_brate(s->gfp, encoder->bitrate);
+      twolame_set_in_samplerate(s->gfp, encoder->target_samplerate);
+      twolame_set_out_samplerate(s->gfp, encoder->target_samplerate);
+      twolame_set_mode(s->gfp, s->lame_mode);
+      //some settings that lame has but toolame doesn't
+      //don't look too important
+      //twolame_set_quality(s->gfp, s->lame_quality);
+      //twolame_set_free_format(s->gfp, s->lame_freeformat);
+      //twolame_set_bWriteVbrTag(s->gfp, 0);
+      if (twolame_init_params(s->gfp) < 0)
          {
          fprintf(stderr, "live_mp3_encoder_main: LAME rejected the parameters given\n");
-         lame_close(s->gfp);
+         twolame_close(s->gfp);
          free(s->mp3buf);
          goto bailout;
          }
@@ -161,7 +163,8 @@
       if (encoder->flush || !encoder->run_request_f)
          {
          encoder->flush = FALSE;
-         mp3bytes = lame_encode_flush_nogap(s->gfp, s->mp3buf, s->mp3bufsize);
+         //twolame seems to lack a _flush_nogap, hopefully _flush will do
+         mp3bytes = twolame_encode_flush(s->gfp, s->mp3buf, s->mp3bufsize);
          fprintf(stderr, "live_mp3_encoder_main: flushing %d bytes\n", mp3bytes);
          live_mp3_write_packet(encoder, s, s->mp3buf, mp3bytes, PF_MP3 | PF_FINAL);
          encoder->encoder_state = ES_STOPPING;
@@ -179,7 +182,7 @@
                   *l++ *= 32768.0F;
                   *r++ *= 32768.0F;
                   }
-            mp3bytes = lame_encode_buffer_float(s->gfp, id->buffer[0], id->buffer[1], id->qty_samples, s->mp3buf, s->mp3bufsize);
+            mp3bytes = twolame_encode_buffer_float32(s->gfp, id->buffer[0], id->buffer[1], id->qty_samples, s->mp3buf, s->mp3bufsize);
             encoder_ip_data_free(id);
             s->lame_samples += id->qty_samples;
             live_mp3_write_packet(encoder, s, s->mp3buf, mp3bytes, PF_MP3 | s->packetflags);
@@ -197,7 +200,7 @@
       }
    if (encoder->encoder_state == ES_STOPPING)
       {
-      lame_close(s->gfp);
+      twolame_close(s->gfp);
       free(s->mp3buf);
       if (encoder->run_request_f)
          {
diff -ur idjc-0.7.5/c/live_mp3_encoder.h idjc-0.7.5-new/c/live_mp3_encoder.h
--- idjc-0.7.5/c/live_mp3_encoder.h	2007-11-29 13:20:25.000000000 +0000
+++ idjc-0.7.5-new/c/live_mp3_encoder.h	2008-06-03 19:18:50.000000000 +0000
@@ -20,12 +20,12 @@
 #include "../config.h"
 #ifdef HAVE_LAME
 
-#include <lame/lame.h>
+#include <twolame.h>
 #include "sourceclient.h"
 
 struct lme_data
    {
-   lame_global_flags *gfp;
+   twolame_options *gfp;
    int lame_mode;
    int lame_channels;
    int lame_quality;
diff -ur idjc-0.7.5/configure idjc-0.7.5-new/configure
--- idjc-0.7.5/configure	2008-04-19 18:11:12.000000000 +0000
+++ idjc-0.7.5-new/configure	2008-06-03 19:13:00.000000000 +0000
@@ -5101,13 +5101,13 @@
 fi
 
 
-{ echo "$as_me:$LINENO: checking for lame_init in -lmp3lame -lm" >&5
-echo $ECHO_N "checking for lame_init in -lmp3lame -lm... $ECHO_C" >&6; }
-if test "${ac_cv_lib_mp3lame__lm_lame_init+set}" = set; then
+{ echo "$as_me:$LINENO: checking for twolame_init in -ltwolame -lm" >&5
+echo $ECHO_N "checking for twolame_init in -ltwolame -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_twolame__lm_twolame_init+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmp3lame -lm  $LIBS"
+LIBS="-ltwolame -lm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5121,11 +5121,11 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-char lame_init ();
+char twolame_init ();
 int
 main ()
 {
-return lame_init ();
+return twolame_init ();
   ;
   return 0;
 }
@@ -5148,22 +5148,22 @@
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_mp3lame__lm_lame_init=yes
+  ac_cv_lib_twolame__lm_twolame_init=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_mp3lame__lm_lame_init=no
+	ac_cv_lib_twolame__lm_twolame_init=no
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_mp3lame__lm_lame_init" >&5
-echo "${ECHO_T}$ac_cv_lib_mp3lame__lm_lame_init" >&6; }
-if test $ac_cv_lib_mp3lame__lm_lame_init = yes; then
-  MP3LAME=-lmp3lame
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_twolame__lm_twolame_init" >&5
+echo "${ECHO_T}$ac_cv_lib_twolame__lm_twolame_init" >&6; }
+if test $ac_cv_lib_twolame__lm_twolame_init = yes; then
+  MP3LAME=-ltwolame
 
           HAVE_LAME=1
 
diff -ur idjc-0.7.5/configure.in idjc-0.7.5-new/configure.in
--- idjc-0.7.5/configure.in	2008-04-19 18:11:00.000000000 +0000
+++ idjc-0.7.5-new/configure.in	2008-06-03 19:12:34.000000000 +0000
@@ -60,8 +60,8 @@
                    AC_MSG_WARN([your version of libFLAC lacks oggflac support])])
           AC_DEFINE(FLAC_POST1_1_3, 2,[2 equals version 1.1.3 onwards (hopefully)])])
 
-AC_CHECK_LIB([mp3lame -lm], [lame_init],
-	  [AC_SUBST(MP3LAME, [-lmp3lame])
+AC_CHECK_LIB([twolame -lm], [twolame_init],
+	  [AC_SUBST(MP3LAME, [-ltwolame])
           AC_SUBST(HAVE_LAME, 1)
 	  AC_DEFINE(HAVE_LAME, 1, [Set if 1 if libmp3lame was found])],
           AC_SUBST(HAVE_LAME, 0))
diff -ur idjc-0.7.5/idjcpython/idjc_config.py idjc-0.7.5-new/idjcpython/idjc_config.py
--- idjc-0.7.5/idjcpython/idjc_config.py	2008-06-03 19:45:58.000000000 +0000
+++ idjc-0.7.5-new/idjcpython/idjc_config.py	2008-06-03 19:36:27.000000000 +0000
@@ -2,12 +2,12 @@
 localversion = False
 libexecdir = "/usr/lib/idjc/"
 pkgdatadir = "/usr/share/idjc/"
-mp4enabled = 0
+mp4enabled = 1
 avformat = 1
 avcodec = 1
 mp3enabled = 1
 flacenabled = 1
-lameenabled = 0
+lameenabled = 1
 version = "0.7.5"
 gfext = ".png"
 tipsenabled = 1

Reply to: