Giter Site home page Giter Site logo

Version info in ogg.h about ogg HOT 12 CLOSED

xiph avatar xiph commented on July 28, 2024
Version info in ogg.h

from ogg.

Comments (12)

erikd avatar erikd commented on July 28, 2024

I don't think its a good idea to have it in the header file, mainly because the header and the actual lib can be out-of-sync with each other. Instead, I would suggest a function like:

const char * ogg_version_str (void);

from ogg.

stopiccot avatar stopiccot commented on July 28, 2024

Actually never liked this approach. In my opinion if you have not corresponding versions of library and header it's already something really wrong. That way you can't trust version in pc file also.

from ogg.

stopiccot avatar stopiccot commented on July 28, 2024

Somebody else's thoughts on this?

from ogg.

rillian avatar rillian commented on July 28, 2024

...if you have not corresponding versions of library and header it's already something really wrong. That way you can't trust version in pc file also.

I don't see why the header is any more or less trustworthy than the pc file?

Somebody else's thoughts on this?

I tend to agree with erikd, but I don't think either make sense for libogg. It's quite mature, and unlike codecs is unlikely to have per-release bugs an embedded version string would help track down in the output. What benefit were you hoping to get by adding version information to the header?

If you want make sure the library and header are in sync you need both. For example, libpng does this. In practice no one checks both and compares, so I think it's not worth adding the api surface.

from ogg.

stopiccot avatar stopiccot commented on July 28, 2024

I don't see why the header is any more or less trustworthy than the pc file?

A little missunderstanding here. I'm not saying that pc file is not trustworthy. I'm saying that pc file cannot be used on Windows and OS X. So it would be great to have version info both in header and pc files.

What benefit were you hoping to get by adding version information to the header?

I just like to see library versions while configuring projects like:

-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5") 

from ogg.

tdaede avatar tdaede commented on July 28, 2024

It looks like FindZLib just does a regexp on the .h to find the version.

Source packages of ogg have a configure script, and devel versions have a configure.ac file. This script has a PACKAGE_VERSION line, as well as several OGG_LIB_* lines. Couldn't you parse that?

from ogg.

stopiccot avatar stopiccot commented on July 28, 2024

@tdaede And now imagine someone configuring ogg-dependent project on Windows. In many cases they will use prebuilt binaries pacakges that contain lib and h files only. Or prebuilt framework on OS X. Or even installed devel package from apt-get on Debian. In all this cases you obviously can't parse configure script. Header file seems the only common denominator across all platforms for me.

from ogg.

tdaede avatar tdaede commented on July 28, 2024

On Linux (and OS X when using homebrew), the .pc file will be installed and should always be the mechanism used.

We don't distribute official packages for Windows, and until recently most users of libogg were building it themselves in their own projects. So these prebuilt binary packages don't exist yet. Presumably we can also define what goes in them.

Putting it in a .h file would be okay, but it is slightly weird as it is intended for the build system, not programs using libogg. Does windows have a native version of .pc, maybe provided by OneGet/NuGet? We could also bundle a VERSION file in the binary packages or something.

from ogg.

stopiccot avatar stopiccot commented on July 28, 2024

OS X when using homebrew

While homebrew is awesome for using on developer machines you can't actually link against libraries from homebrew in apps you plan to distribute. You simply can't ask users to install homebrew and run brew install ogg for your app to work. And many OS X developers tend to use frameworks for their dependencies.

until recently most users of libogg were building it themselves in their own projects

And many of them still do. And most of them build ogg once and than copy header and library to some kind of "prebuilt dependencies" folder.

from ogg.

stopiccot avatar stopiccot commented on July 28, 2024

Btw maybe we can simply add version to THIS FILE IS PART OF THE.. disclaimer. And a simple configuration step to keep it updated alongside with copyright year

from ogg.

rillian avatar rillian commented on July 28, 2024

I don't think we're convinced the benefits here outweigh the drawbacks. Closing as wontfix.

from ogg.

tdaede avatar tdaede commented on July 28, 2024

So, I asked on #cmake:

<TD-Linux> is there a standard way to specify a library's version to cmake? like pkg-config, but on windows
<TD-Linux> some projects specify a version in their headers, which is parsed by some cmake regexp, but that is hardly a standard pattern
<ngladitz> the equivalent to pkg-config in cmake would be package configuration files which may also come with package version files
<TD-Linux> ngladitz, ah, I see, thanks! this will also work even if the project wasn't built with cmake, correct?
<ngladitz> yes e.g. Qt5 provides package configuration files but isn't build with cmake

Does this seem like a good solution? If so, you can reopen this issue or make a new one about implementing this.

from ogg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.