Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally disable libopusfile via a Go build tag #24

Closed
wants to merge 5 commits into from

Conversation

ydnar
Copy link
Contributor

@ydnar ydnar commented Aug 13, 2019

This PR adds a new build tag nolibopusfile that conditionally compiles out the code that imports libopusfile. This enables a static binary build on Alpine Linux, which doesn’t have a static libopusfile.

Tests still work:

go test -tags nolibopusfile ./...
go test ./...

Copy link
Owner

@hraban hraban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I like the patch, just some comments on how to explain this to users.


```sh
go build -tags nolibopusfile ...
```
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a blurb here as to why anyone would ever want to do this? It's a pretty esoteric feature and it's good to know you can "safely ignore" it if you're not very experienced with the whole "dependencies, libraries, build systems" yet. Similarly, while the title is technically correct, it's quite generic. Could you reframe it as "Disabling libopusfile (for micro builds)" or something similar? Keep an audience in mind who might be overwhelmed by all the options, and who speaks poor English. It will help keep the issue count down :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact, the comment in your PR is a pretty good example of what I mean :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW it works great on Alpine Linux, both static and dynamically linked to libopus. It even works on scratch with musl libc and libopus* copied from an Alpine builder image.

@hraban
Copy link
Owner

hraban commented Aug 14, 2019

thank you for this patch and for testing it out on Alpine :)

@ydnar
Copy link
Contributor Author

ydnar commented Aug 15, 2019

@hraban fixed!

@hraban
Copy link
Owner

hraban commented Aug 28, 2019

thank you @ydnar. I am running into some issues with travis configuration and I want to make sure the CI runs before merging this in, but that's the only blockade in the way of a merge. once I sort it out on my end it will be ready to go.

Sorry for the delay.

@ydnar
Copy link
Contributor Author

ydnar commented Aug 29, 2019

@hraban realized later that it’s probably reasonable to v3 it and split out file streaming into a separate opus/ogg package, which would do away with the need for conditional build tags.

@hraban
Copy link
Owner

hraban commented Aug 29, 2019

that's not a bad idea, and it would make this a lot easier to test. however I'm not sure about having to maintain two separate versions just for this. many people have v2 installed now, and bumping the major to solve a problem that almost nobody has seems like more trouble than it's worth :/

I'll have another think about it.

@ydnar
Copy link
Contributor Author

ydnar commented Sep 2, 2019

Makes sense. Thanks for looking at it!

@hraban
Copy link
Owner

hraban commented Jul 10, 2020

Hi @ydnar I'm merging these changes in; do you accept me adding you to the AUTHORS file under the following conditions?

Go Opus Authors and copyright holders of this package are listed below, in no
particular order. By adding yourself to this list you agree to license your
contributions under the relevant license (see the LICENSE file).

The LICENSE file contains:

Copyright © 2015-2020 Go Opus Authors (see AUTHORS file)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

i.e. MIT license.

In other words: do you accept licensing your contributions under MIT?

@hraban
Copy link
Owner

hraban commented Jul 10, 2020

I'm sticking with the build tag because I don't want to upgrade the major version for this; there are too many installs and nobody would update for it, so I'd have to maintain two versions for a relatively uninteresting unpopular (🙂) feature.

@ydnar
Copy link
Contributor Author

ydnar commented Jul 10, 2020

I accept. Thanks!

hraban pushed a commit that referenced this pull request Jul 10, 2020
This patch introduces a new build tag `nolibopusfile` that conditionally
compiles out the code that imports `libopusfile`. This enables a static
binary build on Alpine Linux, which doesn’t have a static `libopusfile`.

Tests still work:

```sh
go test -tags nolibopusfile ./...
go test ./...
```

We could also have moved all libopusfile related code (i.e. Stream) into
a separate sub-package, but that would break backwards compatibility.
This feature is too unpopular to justify introducing a new major
version.

See also: #24
@hraban
Copy link
Owner

hraban commented Jul 10, 2020

Closing; superseded by #31

@hraban hraban closed this Jul 10, 2020
hraban added a commit that referenced this pull request Jul 10, 2020
He explicitly allowed me to license his contributions under MIT.

See #24 (comment)
hraban added a commit that referenced this pull request Jul 10, 2020
He explicitly allowed me to license his contributions under MIT.

See #24 (comment)
hraban pushed a commit that referenced this pull request Jul 10, 2020
This patch introduces a new build tag `nolibopusfile` that conditionally
compiles out the code that imports `libopusfile`. This enables a static
binary build on Alpine Linux, which doesn’t have a static `libopusfile`.

Tests still work:

```sh
go test -tags nolibopusfile ./...
go test ./...
```

We could also have moved all libopusfile related code (i.e. Stream) into
a separate sub-package, but that would break backwards compatibility.
This feature is too unpopular to justify introducing a new major
version.

See also: #24
hraban added a commit that referenced this pull request Jul 10, 2020
He explicitly allowed me to license his contributions under MIT.

See #24 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants