pkgsrc-Bugs archive

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

pkg/52310: firefox 54.0 with ALSA option fails to build on NetBSD 7.1



>Number:         52310
>Category:       pkg
>Synopsis:       firefox 54.0 with ALSA option fails to build on NetBSD 7.1
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 18 13:35:00 +0000 2017
>Originator:     Izumi Tsutsui
>Release:        NetBSD 7.1 + pkgsrc HEAD
>Organization:
>Environment:
System: NetBSD 7.1
Architecture: i386
Machine: i386
>Description:
Building firefox 54.0 with alsa option fails with the following error:
> [..] ../../../toolkit/library/libxul.so: undefined reference to `timersub'

It looks timersub() is used in media/libcubeb/src/cubeb_alsa.c
but NetBSD's <sys/time.h> requires _NETBSD_SOURCE to enable it.

>How-To-Repeat:
Build firefox 54.0 with alsa option on NetBSD/i386 7.1.

>Fix:
Also define _NETBSD_SOURCE in patch-media_libcubeb_src_cubeb__alsa.c?

Index: patch-media_libcubeb_src_cubeb__alsa.c
===================================================================
RCS file: /cvsroot/pkgsrc/www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c,v
retrieving revision 1.22
diff -u -p -d -r1.22 patch-media_libcubeb_src_cubeb__alsa.c
--- patch-media_libcubeb_src_cubeb__alsa.c	14 Jun 2017 11:28:44 -0000	1.22
+++ patch-media_libcubeb_src_cubeb__alsa.c	18 Jun 2017 13:26:53 -0000
@@ -5,7 +5,12 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
 
 --- media/libcubeb/src/cubeb_alsa.c.orig	2017-06-05 20:45:14.000000000 +0000
 +++ media/libcubeb/src/cubeb_alsa.c
-@@ -12,6 +12,7 @@
+@@ -8,10 +8,12 @@
+ #define _DEFAULT_SOURCE
+ #define _BSD_SOURCE
+ #define _XOPEN_SOURCE 500
++#define _NETBSD_SOURCE
+ #include <pthread.h>
  #include <sys/time.h>
  #include <assert.h>
  #include <limits.h>
@@ -13,7 +18,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
  #include <poll.h>
  #include <unistd.h>
  #include <alsa/asoundlib.h>
-@@ -25,6 +26,52 @@
+@@ -25,6 +27,52 @@
  
  #define ALSA_PA_PLUGIN "ALSA <-> PulseAudio PCM I/O Plugin"
  
@@ -66,7 +71,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
  /* ALSA is not thread-safe.  snd_pcm_t instances are individually protected
     by the owning cubeb_stream's mutex.  snd_pcm_t creation and destruction
     is not thread-safe until ALSA 1.0.24 (see alsa-lib.git commit 91c9c8f1),
-@@ -65,6 +112,8 @@ struct cubeb {
+@@ -65,6 +113,8 @@ struct cubeb {
       workaround is not required. */
    snd_config_t * local_config;
    int is_pa;
@@ -75,7 +80,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
  };
  
  enum stream_state {
-@@ -243,8 +292,8 @@ set_timeout(struct timeval * timeout, un
+@@ -243,8 +293,8 @@ set_timeout(struct timeval * timeout, un
  static void
  stream_buffer_decrement(cubeb_stream * stm, long count)
  {
@@ -86,7 +91,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    stm->bufframes -= count;
  }
  
-@@ -276,9 +325,9 @@ alsa_process_stream(cubeb_stream * stm)
+@@ -276,9 +326,9 @@ alsa_process_stream(cubeb_stream * stm)
    /* Call _poll_descriptors_revents() even if we don't use it
       to let underlying plugins clear null events.  Otherwise poll()
       may wake up again and again, producing unnecessary CPU usage. */
@@ -98,7 +103,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
  
    /* Got null event? Bail and wait for another wakeup. */
    if (avail == 0) {
-@@ -301,7 +350,7 @@ alsa_process_stream(cubeb_stream * stm)
+@@ -301,7 +351,7 @@ alsa_process_stream(cubeb_stream * stm)
        // TODO: should it be marked as DRAINING?
      }
  
@@ -107,7 +112,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
  
      if (got < 0) {
        avail = got; // the error handler below will recover us
-@@ -345,7 +394,7 @@ alsa_process_stream(cubeb_stream * stm)
+@@ -345,7 +395,7 @@ alsa_process_stream(cubeb_stream * stm)
        (!stm->other_stream || stm->other_stream->bufframes > 0)) {
      long got = avail - stm->bufframes;
      void * other_buffer = stm->other_stream ? stm->other_stream->buffer : NULL;
@@ -116,7 +121,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
  
      /* Correct read size to the other stream available frames */
      if (stm->other_stream && got > (snd_pcm_sframes_t) stm->other_stream->bufframes) {
-@@ -372,8 +421,8 @@ alsa_process_stream(cubeb_stream * stm)
+@@ -372,8 +422,8 @@ alsa_process_stream(cubeb_stream * stm)
      long drain_frames = avail - stm->bufframes;
      double drain_time = (double) drain_frames / stm->params.rate;
  
@@ -127,7 +132,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      stm->bufframes = avail;
  
      /* Mark as draining, unless we're waiting for capture */
-@@ -400,7 +449,7 @@ alsa_process_stream(cubeb_stream * stm)
+@@ -400,7 +450,7 @@ alsa_process_stream(cubeb_stream * stm)
        }
      }
  
@@ -136,7 +141,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      if (wrote < 0) {
        avail = wrote; // the error handler below will recover us
      } else {
-@@ -413,13 +462,13 @@ alsa_process_stream(cubeb_stream * stm)
+@@ -413,13 +463,13 @@ alsa_process_stream(cubeb_stream * stm)
  
    /* Got some error? Let's try to recover the stream. */
    if (avail < 0) {
@@ -153,7 +158,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      }
    }
  
-@@ -535,26 +584,26 @@ get_slave_pcm_node(snd_config_t * lconf,
+@@ -535,26 +585,26 @@ get_slave_pcm_node(snd_config_t * lconf,
  
    slave_def = NULL;
  
@@ -185,7 +190,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      if (r < 0) {
        break;
      }
-@@ -563,7 +612,7 @@ get_slave_pcm_node(snd_config_t * lconf,
+@@ -563,7 +613,7 @@ get_slave_pcm_node(snd_config_t * lconf,
      if (r < 0 || r > (int) sizeof(node_name)) {
        break;
      }
@@ -194,7 +199,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      if (r < 0) {
        break;
      }
-@@ -572,7 +621,7 @@ get_slave_pcm_node(snd_config_t * lconf,
+@@ -572,7 +622,7 @@ get_slave_pcm_node(snd_config_t * lconf,
    } while (0);
  
    if (slave_def) {
@@ -203,7 +208,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    }
  
    return NULL;
-@@ -595,22 +644,22 @@ init_local_config_with_workaround(char c
+@@ -595,22 +645,22 @@ init_local_config_with_workaround(char c
  
    lconf = NULL;
  
@@ -230,7 +235,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      if (r < 0) {
        break;
      }
-@@ -619,7 +668,7 @@ init_local_config_with_workaround(char c
+@@ -619,7 +669,7 @@ init_local_config_with_workaround(char c
      if (r < 0 || r > (int) sizeof(node_name)) {
        break;
      }
@@ -239,7 +244,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      if (r < 0) {
        break;
      }
-@@ -630,12 +679,12 @@ init_local_config_with_workaround(char c
+@@ -630,12 +680,12 @@ init_local_config_with_workaround(char c
      }
  
      /* Fetch the PCM node's type, and bail out if it's not the PulseAudio plugin. */
@@ -254,7 +259,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      if (r < 0) {
        break;
      }
-@@ -646,18 +695,18 @@ init_local_config_with_workaround(char c
+@@ -646,18 +696,18 @@ init_local_config_with_workaround(char c
  
      /* Don't clobber an explicit existing handle_underrun value, set it only
         if it doesn't already exist. */
@@ -276,7 +281,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      if (r < 0) {
        break;
      }
-@@ -665,7 +714,7 @@ init_local_config_with_workaround(char c
+@@ -665,7 +715,7 @@ init_local_config_with_workaround(char c
      return lconf;
    } while (0);
  
@@ -285,7 +290,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
  
    return NULL;
  }
-@@ -677,9 +726,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, c
+@@ -677,9 +727,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, c
  
    pthread_mutex_lock(&cubeb_alsa_mutex);
    if (local_config) {
@@ -297,7 +302,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    }
    pthread_mutex_unlock(&cubeb_alsa_mutex);
  
-@@ -692,7 +741,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm)
+@@ -692,7 +742,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm)
    int r;
  
    pthread_mutex_lock(&cubeb_alsa_mutex);
@@ -306,7 +311,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    pthread_mutex_unlock(&cubeb_alsa_mutex);
  
    return r;
-@@ -755,12 +804,65 @@ alsa_init(cubeb ** context, char const *
+@@ -755,12 +805,65 @@ alsa_init(cubeb ** context, char const *
    pthread_attr_t attr;
    snd_pcm_t * dummy;
  
@@ -373,7 +378,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      cubeb_alsa_error_handler_set = 1;
    }
    pthread_mutex_unlock(&cubeb_alsa_mutex);
-@@ -768,6 +870,8 @@ alsa_init(cubeb ** context, char const *
+@@ -768,6 +871,8 @@ alsa_init(cubeb ** context, char const *
    ctx = calloc(1, sizeof(*ctx));
    assert(ctx);
  
@@ -382,7 +387,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    ctx->ops = &alsa_ops;
  
    r = pthread_mutex_init(&ctx->mutex, NULL);
-@@ -817,7 +921,7 @@ alsa_init(cubeb ** context, char const *
+@@ -817,7 +922,7 @@ alsa_init(cubeb ** context, char const *
         config fails with EINVAL, the PA PCM is too old for this workaround. */
      if (r == -EINVAL) {
        pthread_mutex_lock(&cubeb_alsa_mutex);
@@ -391,7 +396,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
        pthread_mutex_unlock(&cubeb_alsa_mutex);
        ctx->local_config = NULL;
      } else if (r >= 0) {
-@@ -857,9 +961,13 @@ alsa_destroy(cubeb * ctx)
+@@ -857,9 +962,13 @@ alsa_destroy(cubeb * ctx)
    pthread_mutex_destroy(&ctx->mutex);
    free(ctx->fds);
  
@@ -406,7 +411,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      pthread_mutex_unlock(&cubeb_alsa_mutex);
    }
  
-@@ -942,7 +1050,7 @@ alsa_stream_init_single(cubeb * ctx, cub
+@@ -942,7 +1051,7 @@ alsa_stream_init_single(cubeb * ctx, cub
      return CUBEB_ERROR;
    }
  
@@ -415,7 +420,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    assert(r == 0);
  
    latency_us = latency_frames * 1e6 / stm->params.rate;
-@@ -955,7 +1063,7 @@ alsa_stream_init_single(cubeb * ctx, cub
+@@ -955,7 +1064,7 @@ alsa_stream_init_single(cubeb * ctx, cub
      latency_us = latency_us < min_latency ? min_latency: latency_us;
    }
  
@@ -424,7 +429,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
                           stm->params.channels, stm->params.rate, 1,
                           latency_us);
    if (r < 0) {
-@@ -963,20 +1071,20 @@ alsa_stream_init_single(cubeb * ctx, cub
+@@ -963,20 +1072,20 @@ alsa_stream_init_single(cubeb * ctx, cub
      return CUBEB_ERROR_INVALID_FORMAT;
    }
  
@@ -449,7 +454,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    assert((nfds_t) r == stm->nfds);
  
    if (alsa_register_stream(ctx, stm) != 0) {
-@@ -1048,7 +1156,7 @@ alsa_stream_destroy(cubeb_stream * stm)
+@@ -1048,7 +1157,7 @@ alsa_stream_destroy(cubeb_stream * stm)
    pthread_mutex_lock(&stm->mutex);
    if (stm->pcm) {
      if (stm->state == DRAINING) {
@@ -458,7 +463,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      }
      alsa_locked_pcm_close(stm->pcm);
      stm->pcm = NULL;
-@@ -1094,12 +1202,12 @@ alsa_get_max_channel_count(cubeb * ctx, 
+@@ -1094,12 +1203,12 @@ alsa_get_max_channel_count(cubeb * ctx, 
  
    assert(stm);
  
@@ -473,7 +478,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    if (r < 0) {
      return CUBEB_ERROR;
    }
-@@ -1120,34 +1228,34 @@ alsa_get_preferred_sample_rate(cubeb * c
+@@ -1120,34 +1229,34 @@ alsa_get_preferred_sample_rate(cubeb * c
  
    /* get a pcm, disabling resampling, so we get a rate the
     * hardware/dmix/pulse/etc. supports. */
@@ -516,7 +521,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
  
    return CUBEB_OK;
  }
-@@ -1180,10 +1288,10 @@ alsa_stream_start(cubeb_stream * stm)
+@@ -1180,10 +1289,10 @@ alsa_stream_start(cubeb_stream * stm)
    pthread_mutex_lock(&stm->mutex);
    /* Capture pcm must be started after initial setup/recover */
    if (stm->stream_type == SND_PCM_STREAM_CAPTURE &&
@@ -530,7 +535,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    gettimeofday(&stm->last_activity, NULL);
    pthread_mutex_unlock(&stm->mutex);
  
-@@ -1223,7 +1331,7 @@ alsa_stream_stop(cubeb_stream * stm)
+@@ -1223,7 +1332,7 @@ alsa_stream_stop(cubeb_stream * stm)
    pthread_mutex_unlock(&ctx->mutex);
  
    pthread_mutex_lock(&stm->mutex);
@@ -539,7 +544,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
    pthread_mutex_unlock(&stm->mutex);
  
    return CUBEB_OK;
-@@ -1239,8 +1347,8 @@ alsa_stream_get_position(cubeb_stream * 
+@@ -1239,8 +1348,8 @@ alsa_stream_get_position(cubeb_stream * 
    pthread_mutex_lock(&stm->mutex);
  
    delay = -1;
@@ -550,7 +555,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb_
      *position = stm->last_position;
      pthread_mutex_unlock(&stm->mutex);
      return CUBEB_OK;
-@@ -1265,7 +1373,7 @@ alsa_stream_get_latency(cubeb_stream * s
+@@ -1265,7 +1374,7 @@ alsa_stream_get_latency(cubeb_stream * s
    snd_pcm_sframes_t delay;
    /* This function returns the delay in frames until a frame written using
       snd_pcm_writei is sent to the DAC. The DAC delay should be < 1ms anyways. */



Home | Main Index | Thread Index | Old Index