flac/0001-getopt_long-not-broken-here.patch
Cristian Rodríguez 8b674da586 Accepting request 176579 from home:elvigia:branches:multimedia:libs
- Update to flac 1.3.0pre4 (packaged as 1.2.99_git* to avoid
 messing with RPM versioning)
 * Mostly non-linux related bugfixes plus autotools fixes
 - flac-openssl.patch --> 0001-Allow-use-of-openSSL.patch 
 - remove flac-1.2.1-automake1_13.patch, fixed in upstream.
 - add 0001-getopt_long-not-broken-here.patch, FLAC bundles
   GNU-compatible getopt_long for broken OS, but we do have
   a functional version in libc already.

OBS-URL: https://build.opensuse.org/request/show/176579
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/flac?expand=0&rev=37
2013-05-27 20:16:09 +00:00

426 lines
18 KiB
Diff

From 58064f7aaf9934799c4ae578194892098cca3995 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
Date: Sun, 26 May 2013 05:50:21 +0200
Subject: [PATCH] getopt_long not broken here.
bundled version is used everywhere even when linux getopt_long
is not broken, exclude that from our builds
diff --git a/src/flac/Makefile.am b/src/flac/Makefile.am
index ceae6a5..bd609e0 100644
--- a/src/flac/Makefile.am
+++ b/src/flac/Makefile.am
@@ -46,7 +46,6 @@ flac_SOURCES = \
flac_LDADD = \
$(top_builddir)/src/share/utf8/libutf8.la \
$(top_builddir)/src/share/grabbag/libgrabbag.la \
- $(top_builddir)/src/share/getopt/libgetopt.la \
$(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
$(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \
$(top_builddir)/src/libFLAC/libFLAC.la \
diff --git a/src/flac/main.c b/src/flac/main.c
index 62e54a4..4cfa64f 100644
--- a/src/flac/main.c
+++ b/src/flac/main.c
@@ -51,13 +51,7 @@
#define FLAC__STRCASECMP strcasecmp
#endif
-#if 0
-/*[JEC] was:#if HAVE_GETOPT_LONG*/
-/*[JEC] see flac/include/share/getopt.h as to why the change */
# include <getopt.h>
-#else
-# include "share/getopt.h"
-#endif
static int do_it(void);
@@ -88,131 +82,131 @@ static int conditional_fclose(FILE *f);
static char *local_strdup(const char *source);
/*
- * share__getopt format struct; note that for long options with no
+ * getopt format struct; note that for long options with no
* short option equivalent we just set the 'val' field to 0.
*/
-static struct share__option long_options_[] = {
+static struct option long_options_[] = {
/*
* general options
*/
- { "help" , share__no_argument, 0, 'h' },
- { "explain" , share__no_argument, 0, 'H' },
- { "version" , share__no_argument, 0, 'v' },
- { "decode" , share__no_argument, 0, 'd' },
- { "analyze" , share__no_argument, 0, 'a' },
- { "test" , share__no_argument, 0, 't' },
- { "stdout" , share__no_argument, 0, 'c' },
- { "silent" , share__no_argument, 0, 's' },
- { "totally-silent" , share__no_argument, 0, 0 },
- { "warnings-as-errors" , share__no_argument, 0, 'w' },
- { "force" , share__no_argument, 0, 'f' },
- { "delete-input-file" , share__no_argument, 0, 0 },
- { "preserve-modtime" , share__no_argument, 0, 0 },
- { "keep-foreign-metadata" , share__no_argument, 0, 0 },
- { "output-prefix" , share__required_argument, 0, 0 },
- { "output-name" , share__required_argument, 0, 'o' },
- { "skip" , share__required_argument, 0, 0 },
- { "until" , share__required_argument, 0, 0 },
- { "channel-map" , share__required_argument, 0, 0 }, /* undocumented */
+ { "help" , no_argument, 0, 'h' },
+ { "explain" , no_argument, 0, 'H' },
+ { "version" , no_argument, 0, 'v' },
+ { "decode" , no_argument, 0, 'd' },
+ { "analyze" , no_argument, 0, 'a' },
+ { "test" , no_argument, 0, 't' },
+ { "stdout" , no_argument, 0, 'c' },
+ { "silent" , no_argument, 0, 's' },
+ { "totally-silent" , no_argument, 0, 0 },
+ { "warnings-as-errors" , no_argument, 0, 'w' },
+ { "force" , no_argument, 0, 'f' },
+ { "delete-input-file" , no_argument, 0, 0 },
+ { "preserve-modtime" , no_argument, 0, 0 },
+ { "keep-foreign-metadata" , no_argument, 0, 0 },
+ { "output-prefix" , required_argument, 0, 0 },
+ { "output-name" , required_argument, 0, 'o' },
+ { "skip" , required_argument, 0, 0 },
+ { "until" , required_argument, 0, 0 },
+ { "channel-map" , required_argument, 0, 0 }, /* undocumented */
/*
* decoding options
*/
- { "decode-through-errors", share__no_argument, 0, 'F' },
- { "cue" , share__required_argument, 0, 0 },
- { "apply-replaygain-which-is-not-lossless", share__optional_argument, 0, 0 }, /* undocumented */
+ { "decode-through-errors", no_argument, 0, 'F' },
+ { "cue" , required_argument, 0, 0 },
+ { "apply-replaygain-which-is-not-lossless", optional_argument, 0, 0 }, /* undocumented */
/*
* encoding options
*/
- { "cuesheet" , share__required_argument, 0, 0 },
- { "no-cued-seekpoints" , share__no_argument, 0, 0 },
- { "picture" , share__required_argument, 0, 0 },
- { "tag" , share__required_argument, 0, 'T' },
- { "tag-from-file" , share__required_argument, 0, 0 },
- { "compression-level-0" , share__no_argument, 0, '0' },
- { "compression-level-1" , share__no_argument, 0, '1' },
- { "compression-level-2" , share__no_argument, 0, '2' },
- { "compression-level-3" , share__no_argument, 0, '3' },
- { "compression-level-4" , share__no_argument, 0, '4' },
- { "compression-level-5" , share__no_argument, 0, '5' },
- { "compression-level-6" , share__no_argument, 0, '6' },
- { "compression-level-7" , share__no_argument, 0, '7' },
- { "compression-level-8" , share__no_argument, 0, '8' },
- { "compression-level-9" , share__no_argument, 0, '9' },
- { "best" , share__no_argument, 0, '8' },
- { "fast" , share__no_argument, 0, '0' },
- { "verify" , share__no_argument, 0, 'V' },
- { "force-raw-format" , share__no_argument, 0, 0 },
- { "force-aiff-format" , share__no_argument, 0, 0 },
- { "force-rf64-format" , share__no_argument, 0, 0 },
- { "force-wave64-format" , share__no_argument, 0, 0 },
- { "lax" , share__no_argument, 0, 0 },
- { "replay-gain" , share__no_argument, 0, 0 },
- { "ignore-chunk-sizes" , share__no_argument, 0, 0 },
- { "sector-align" , share__no_argument, 0, 0 }, /* DEPRECATED */
- { "seekpoint" , share__required_argument, 0, 'S' },
- { "padding" , share__required_argument, 0, 'P' },
+ { "cuesheet" , required_argument, 0, 0 },
+ { "no-cued-seekpoints" , no_argument, 0, 0 },
+ { "picture" , required_argument, 0, 0 },
+ { "tag" , required_argument, 0, 'T' },
+ { "tag-from-file" , required_argument, 0, 0 },
+ { "compression-level-0" , no_argument, 0, '0' },
+ { "compression-level-1" , no_argument, 0, '1' },
+ { "compression-level-2" , no_argument, 0, '2' },
+ { "compression-level-3" , no_argument, 0, '3' },
+ { "compression-level-4" , no_argument, 0, '4' },
+ { "compression-level-5" , no_argument, 0, '5' },
+ { "compression-level-6" , no_argument, 0, '6' },
+ { "compression-level-7" , no_argument, 0, '7' },
+ { "compression-level-8" , no_argument, 0, '8' },
+ { "compression-level-9" , no_argument, 0, '9' },
+ { "best" , no_argument, 0, '8' },
+ { "fast" , no_argument, 0, '0' },
+ { "verify" , no_argument, 0, 'V' },
+ { "force-raw-format" , no_argument, 0, 0 },
+ { "force-aiff-format" , no_argument, 0, 0 },
+ { "force-rf64-format" , no_argument, 0, 0 },
+ { "force-wave64-format" , no_argument, 0, 0 },
+ { "lax" , no_argument, 0, 0 },
+ { "replay-gain" , no_argument, 0, 0 },
+ { "ignore-chunk-sizes" , no_argument, 0, 0 },
+ { "sector-align" , no_argument, 0, 0 }, /* DEPRECATED */
+ { "seekpoint" , required_argument, 0, 'S' },
+ { "padding" , required_argument, 0, 'P' },
#if FLAC__HAS_OGG
- { "ogg" , share__no_argument, 0, 0 },
- { "serial-number" , share__required_argument, 0, 0 },
+ { "ogg" , no_argument, 0, 0 },
+ { "serial-number" , required_argument, 0, 0 },
#endif
- { "blocksize" , share__required_argument, 0, 'b' },
- { "exhaustive-model-search" , share__no_argument, 0, 'e' },
- { "max-lpc-order" , share__required_argument, 0, 'l' },
- { "apodization" , share__required_argument, 0, 'A' },
- { "mid-side" , share__no_argument, 0, 'm' },
- { "adaptive-mid-side" , share__no_argument, 0, 'M' },
- { "qlp-coeff-precision-search", share__no_argument, 0, 'p' },
- { "qlp-coeff-precision" , share__required_argument, 0, 'q' },
- { "rice-partition-order" , share__required_argument, 0, 'r' },
- { "endian" , share__required_argument, 0, 0 },
- { "channels" , share__required_argument, 0, 0 },
- { "bps" , share__required_argument, 0, 0 },
- { "sample-rate" , share__required_argument, 0, 0 },
- { "sign" , share__required_argument, 0, 0 },
- { "input-size" , share__required_argument, 0, 0 },
+ { "blocksize" , required_argument, 0, 'b' },
+ { "exhaustive-model-search" , no_argument, 0, 'e' },
+ { "max-lpc-order" , required_argument, 0, 'l' },
+ { "apodization" , required_argument, 0, 'A' },
+ { "mid-side" , no_argument, 0, 'm' },
+ { "adaptive-mid-side" , no_argument, 0, 'M' },
+ { "qlp-coeff-precision-search", no_argument, 0, 'p' },
+ { "qlp-coeff-precision" , required_argument, 0, 'q' },
+ { "rice-partition-order" , required_argument, 0, 'r' },
+ { "endian" , required_argument, 0, 0 },
+ { "channels" , required_argument, 0, 0 },
+ { "bps" , required_argument, 0, 0 },
+ { "sample-rate" , required_argument, 0, 0 },
+ { "sign" , required_argument, 0, 0 },
+ { "input-size" , required_argument, 0, 0 },
/*
* analysis options
*/
- { "residual-gnuplot", share__no_argument, 0, 0 },
- { "residual-text", share__no_argument, 0, 0 },
+ { "residual-gnuplot", no_argument, 0, 0 },
+ { "residual-text", no_argument, 0, 0 },
/*
* negatives
*/
- { "no-preserve-modtime" , share__no_argument, 0, 0 },
- { "no-decode-through-errors" , share__no_argument, 0, 0 },
- { "no-silent" , share__no_argument, 0, 0 },
- { "no-force" , share__no_argument, 0, 0 },
- { "no-seektable" , share__no_argument, 0, 0 },
- { "no-delete-input-file" , share__no_argument, 0, 0 },
- { "no-keep-foreign-metadata" , share__no_argument, 0, 0 },
- { "no-replay-gain" , share__no_argument, 0, 0 },
- { "no-ignore-chunk-sizes" , share__no_argument, 0, 0 },
- { "no-sector-align" , share__no_argument, 0, 0 }, /* DEPRECATED */
- { "no-utf8-convert" , share__no_argument, 0, 0 },
- { "no-lax" , share__no_argument, 0, 0 },
+ { "no-preserve-modtime" , no_argument, 0, 0 },
+ { "no-decode-through-errors" , no_argument, 0, 0 },
+ { "no-silent" , no_argument, 0, 0 },
+ { "no-force" , no_argument, 0, 0 },
+ { "no-seektable" , no_argument, 0, 0 },
+ { "no-delete-input-file" , no_argument, 0, 0 },
+ { "no-keep-foreign-metadata" , no_argument, 0, 0 },
+ { "no-replay-gain" , no_argument, 0, 0 },
+ { "no-ignore-chunk-sizes" , no_argument, 0, 0 },
+ { "no-sector-align" , no_argument, 0, 0 }, /* DEPRECATED */
+ { "no-utf8-convert" , no_argument, 0, 0 },
+ { "no-lax" , no_argument, 0, 0 },
#if FLAC__HAS_OGG
- { "no-ogg" , share__no_argument, 0, 0 },
+ { "no-ogg" , no_argument, 0, 0 },
#endif
- { "no-exhaustive-model-search", share__no_argument, 0, 0 },
- { "no-mid-side" , share__no_argument, 0, 0 },
- { "no-adaptive-mid-side" , share__no_argument, 0, 0 },
- { "no-qlp-coeff-prec-search" , share__no_argument, 0, 0 },
- { "no-padding" , share__no_argument, 0, 0 },
- { "no-verify" , share__no_argument, 0, 0 },
- { "no-warnings-as-errors" , share__no_argument, 0, 0 },
- { "no-residual-gnuplot" , share__no_argument, 0, 0 },
- { "no-residual-text" , share__no_argument, 0, 0 },
+ { "no-exhaustive-model-search", no_argument, 0, 0 },
+ { "no-mid-side" , no_argument, 0, 0 },
+ { "no-adaptive-mid-side" , no_argument, 0, 0 },
+ { "no-qlp-coeff-prec-search" , no_argument, 0, 0 },
+ { "no-padding" , no_argument, 0, 0 },
+ { "no-verify" , no_argument, 0, 0 },
+ { "no-warnings-as-errors" , no_argument, 0, 0 },
+ { "no-residual-gnuplot" , no_argument, 0, 0 },
+ { "no-residual-text" , no_argument, 0, 0 },
/*
* undocumented debugging options for the test suite
*/
- { "disable-constant-subframes", share__no_argument, 0, 0 },
- { "disable-fixed-subframes" , share__no_argument, 0, 0 },
- { "disable-verbatim-subframes", share__no_argument, 0, 0 },
- { "no-md5-sum" , share__no_argument, 0, 0 },
+ { "disable-constant-subframes", no_argument, 0, 0 },
+ { "disable-fixed-subframes" , no_argument, 0, 0 },
+ { "disable-verbatim-subframes", no_argument, 0, 0 },
+ { "no-md5-sum" , no_argument, 0, 0 },
{0, 0, 0, 0}
};
@@ -616,17 +610,17 @@ int parse_options(int argc, char *argv[])
FLAC__bool had_error = false;
const char *short_opts = "0123456789aA:b:cdefFhHl:mMo:pP:q:r:sS:tT:vVw";
- while ((short_option = share__getopt_long(argc, argv, short_opts, long_options_, &option_index)) != -1) {
+ while ((short_option = getopt_long(argc, argv, short_opts, long_options_, &option_index)) != -1) {
switch (short_option) {
case 0: /* long option with no equivalent short option */
- had_error |= (parse_option(short_option, long_options_[option_index].name, share__optarg) != 0);
+ had_error |= (parse_option(short_option, long_options_[option_index].name, optarg) != 0);
break;
case '?':
case ':':
had_error = true;
break;
default: /* short option */
- had_error |= (parse_option(short_option, 0, share__optarg) != 0);
+ had_error |= (parse_option(short_option, 0, optarg) != 0);
break;
}
}
@@ -635,16 +629,16 @@ int parse_options(int argc, char *argv[])
return 1;
}
- FLAC__ASSERT(share__optind <= argc);
+ FLAC__ASSERT(optind <= argc);
- option_values.num_files = argc - share__optind;
+ option_values.num_files = argc - optind;
if(option_values.num_files > 0) {
unsigned i = 0;
if(0 == (option_values.filenames = malloc(sizeof(char*) * option_values.num_files)))
die("out of memory allocating space for file names list");
- while(share__optind < argc)
- option_values.filenames[i++] = local_strdup(argv[share__optind++]);
+ while(optind < argc)
+ option_values.filenames[i++] = local_strdup(argv[optind++]);
}
return 0;
diff --git a/src/metaflac/Makefile.am b/src/metaflac/Makefile.am
index 35460b1..114a066 100644
--- a/src/metaflac/Makefile.am
+++ b/src/metaflac/Makefile.am
@@ -44,7 +44,6 @@ metaflac_LDFLAGS = $(AM_LDFLAGS)
metaflac_LDADD = \
$(top_builddir)/src/share/grabbag/libgrabbag.la \
$(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
- $(top_builddir)/src/share/getopt/libgetopt.la \
$(top_builddir)/src/share/utf8/libutf8.la \
$(top_builddir)/src/libFLAC/libFLAC.la \
@LIBICONV@
diff --git a/src/metaflac/options.c b/src/metaflac/options.c
index e8e6151..68aab3e 100644
--- a/src/metaflac/options.c
+++ b/src/metaflac/options.c
@@ -33,10 +33,10 @@
#include <string.h>
/*
- share__getopt format struct; note we don't use short options so we just
+ getopt format struct; note we don't use short options so we just
set the 'val' field to 0 everywhere to indicate a valid option.
*/
-struct share__option long_options_[] = {
+struct option long_options_[] = {
/* global options */
{ "preserve-modtime", 0, 0, 0 },
{ "with-filename", 0, 0, 0 },
@@ -159,10 +159,10 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options)
int option_index = 1;
FLAC__bool had_error = false;
- while ((ret = share__getopt_long(argc, argv, "", long_options_, &option_index)) != -1) {
+ while ((ret = getopt_long(argc, argv, "", long_options_, &option_index)) != -1) {
switch (ret) {
case 0:
- had_error |= !parse_option(option_index, share__optarg, options);
+ had_error |= !parse_option(option_index, optarg, options);
break;
case '?':
case ':':
@@ -175,22 +175,22 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options)
}
if(options->prefix_with_filename == 2)
- options->prefix_with_filename = (argc - share__optind > 1);
+ options->prefix_with_filename = (argc - optind > 1);
- if(share__optind >= argc && !options->show_long_help && !options->show_version) {
+ if(optind >= argc && !options->show_long_help && !options->show_version) {
flac_fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n");
flac_fprintf(stderr," metaflac cannot be used as a pipe\n");
had_error = true;
}
- options->num_files = argc - share__optind;
+ options->num_files = argc - optind;
if(options->num_files > 0) {
unsigned i = 0;
if(0 == (options->filenames = safe_malloc_mul_2op_(sizeof(char*), /*times*/options->num_files)))
die("out of memory allocating space for file names list");
- while(share__optind < argc)
- options->filenames[i++] = local_strdup(argv[share__optind++]);
+ while(optind < argc)
+ options->filenames[i++] = local_strdup(argv[optind++]);
}
if(options->args.checks.num_major_ops > 0) {
diff --git a/src/metaflac/options.h b/src/metaflac/options.h
index 63079fe..944b1bf 100644
--- a/src/metaflac/options.h
+++ b/src/metaflac/options.h
@@ -21,15 +21,9 @@
#include "FLAC/format.h"
-#if 0
-/*[JEC] was:#if HAVE_GETOPT_LONG*/
-/*[JEC] see flac/include/share/getopt.h as to why the change */
-# include <getopt.h>
-#else
-# include "share/getopt.h"
-#endif
+#include <getopt.h>
-extern struct share__option long_options_[];
+extern struct option long_options_[];
typedef enum {
OP__SHOW_MD5SUM,
diff --git a/src/share/Makefile.am b/src/share/Makefile.am
index d9521ce..e9f8dcd 100644
--- a/src/share/Makefile.am
+++ b/src/share/Makefile.am
@@ -42,7 +42,6 @@ EXTRA_DIST = \
noinst_LTLIBRARIES = \
- getopt/libgetopt.la \
grabbag/libgrabbag.la \
utf8/libutf8.la \
$(libwin_utf8_io) \
@@ -59,8 +58,6 @@ libwin_utf8_io =
endif
-getopt_libgetopt_la_SOURCES = getopt/getopt.c getopt/getopt1.c
-
grabbag_libgrabbag_la_SOURCES = \
grabbag/alloc.c \
grabbag/cuesheet.c \
--
1.8.1.4