Closed Bug 868629 Opened 11 years ago Closed 11 years ago

[webvtt] remove WEBVTT_NO_CONFIG_H

Categories

(Core :: Audio/Video, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: rillian, Assigned: caitlin.potter)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 4 obsolete files)

Right now the webvtt library headers must be used with WEBVTT_NO_CONFIG_H unless the build includes a generated config.h in the public header set. This is confusing and brittle and quite a few developers have complained about it.

This bug is to make it possible to build and/or #include the headers in Firefox without setting a magic flag.
As discussed on irc:

The configuration header doesn't really contain much -- it only tells us whether or not stdint.h is available, and whether strerror() is available (only used by the demo application).

I've suggested that we can get around requiring a check for stdint.h by assuming it is present, except when it is known to not be present. eg, defined(_MSC_VER) && _MSC_VER < 1600).

The demo application doesn't necessarily need to use strerror(), and so this can be removed as well.

The result is that there is no real need to depend on a configuration header in the first place.

If there are any other suggestions I'm happy to implement them on monday
It would also simplify things further to just not build webvtt as a shared library, which would eliminate the requirement for -DWEBVTT_STATIC as well.
It's fine to #ifdef HAVE_CONFIG_H / #include "config.h" in the demo application for things like strerror().
https://github.com/mozilla/webvtt/pull/389 -- The current strategy checks if HAVE_CONFIG_H is defined (if true, attempts to include "config.h") -- but otherwise, some assumptions are made regarding the availability of C99 features like stdint.h

I've removed the conditional strerror() in the demo application, because I think it's a pretty widely supported feature that mostly varies in terms of thread safety. Should be okay for the synchronous demo app, and if it fails to build it's not really going to hurt anybody too badly. But this can be updated if need be.

What are your thoughts on the removal of the shared library build? It would simplify things a bit.
Requirement for passing -DWEBVTT_NO_CONFIG_H on the command line has been removed. -DWEBVTT_STATIC is still required, unfortunately.
Attachment #745985 - Flags: review?
Comment on attachment 745985 [details] [diff] [review]
Update media/webvtt (revision no longer requires -DWEBVTT_NO_CONFIG_H)

Is this an update to the current revision? I'd rather you backported the specific fix for this bug (removing webvtt-config.h) as a patch until we can tag a new upstream release.
Attachment #745985 - Flags: review? → review-
Backported fixes added in mozilla/webvtt bb41b6128f. (config.h is no longer included at all in webvtt/util.h).

Readme updated to reflect this.
Attachment #745985 - Attachment is obsolete: true
Attachment #746543 - Flags: review?(giles)
Quick fixup to attachment 746543 [details] [diff] [review] -- Make sure WEBVTT_OS_WIN32/64 get defined (they are used further down)
Attachment #746543 - Attachment is obsolete: true
Attachment #746543 - Flags: review?(giles)
Attachment #746565 - Flags: review?(giles)
Status: NEW → ASSIGNED
Comment on attachment 746565 [details] [diff] [review]
webvtt no longer needs -DWEBVTT_NO_CONFIG_H. r=rillian

Review of attachment 746565 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for backporting just the relevant changes. Those look good.

Please also include a patch file and apply it at the bottom of media/webvtt/update.sh so running the script produces the correct code. This makes it obvious how we've diverged from the upstream release.
Attachment #746565 - Flags: review?(giles) → review-
Changes to update.sh:
- Given execute permissions (filemode 755 now)
- Applies patch for bug 868629 (This will probably need to be removed after the next tagged release is imported)

Now includes the original patch (media/webvtt/868629.patch)
Attachment #746565 - Attachment is obsolete: true
Attachment #747189 - Flags: review?(giles)
Forgot to mention above, I've also changed the shebang line for the update script, because it's not valid Bourne shell script (which is the default on this system).

Maybe some effort into making it more portable can be done later on.
Comment on attachment 747189 [details] [diff] [review]
webvtt no longer needs -DWEBVTT_NO_CONFIG_H. r=rillian

Review of attachment 747189 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with fixes.

::: media/webvtt/868629.patch
@@ +4,5 @@
> +# Node ID 2becb21900559e271175e08d7ec33ed35b034967
> +# Parent  41ff3b67b69232297191c8f8ef78e5facc1c1d19
> +Bug 868629 - webvtt no longer needs -DWEBVTT_NO_CONFIG_H. r=rillian
> +
> +diff --git a/media/webvtt/README_MOZILLA b/media/webvtt/README_MOZILLA

Don't include README_MOZILLA in the patch. This file is only in the mozilla repo, so changes are already tracked. We just want the diff to the upstream code.

Also lets you re-run update.sh without getting 'already applied' errors.

::: media/webvtt/update.sh
@@ +77,5 @@
>  if [ ${have_hg} -eq 0 -a -d ${start_dir}/.hg ]; then
>    hg addremove ${webvtt_dir}/
>  fi
> +
> +# apply patches (from root of tree)

This doesn't work when invoked as './update.sh' because webvtt_dir is '.' Just assume you're running in the local directory like all the other media/*/update.sh.

You can use patch -p3 instead to strip the prefix.

@@ +79,5 @@
>  fi
> +
> +# apply patches (from root of tree)
> +cd ${webvtt_dir}/../..
> +patch -p1 -i ${webvtt_dir}/868629.patch

'patch -i' isn't portable. Please use 'patch -p3 < 868629.patch' instead.
Attachment #747189 - Flags: review?(giles) → review+
Updated code builds on try. https://tbpl.mozilla.org/?tree=Try&rev=1e6fb308ec75
Comment on attachment 749384 [details] [diff] [review]
Bug 868629 - webvtt no longer needs -DWEBVTT_NO_CONFIG_H. r=rillian

https://hg.mozilla.org/integration/mozilla-inbound/rev/e635e544621e
Attachment #749384 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/e635e544621e
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: