[vlc-commits] [Git][videolan/vlc][master] libvlc: hardcode the values in libvlc_version.h

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Dec 9 10:22:03 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
92efc846 by Steve Lhomme at 2022-12-09T10:01:17+00:00
libvlc: hardcode the values in libvlc_version.h

So it doesn't need to be generated to be used.

We check the values match the ones in configure.ac during compilation.

- - - - -


5 changed files:

- .gitignore
- configure.ac
- include/vlc/libvlc_version.h.in → include/vlc/libvlc_version.h
- lib/Makefile.am
- lib/core.c


Changes:

=====================================
.gitignore
=====================================
@@ -47,8 +47,6 @@ vlc_install_dir/*
 plugins.dat
 patches/*
 
-include/vlc/libvlc_version.h
-
 # Ignore build dirs
 build*/
 contrib-*


=====================================
configure.ac
=====================================
@@ -4614,6 +4614,9 @@ AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],${VERSION_MINOR}, [version minor numb
 AC_DEFINE_UNQUOTED([PACKAGE_VERSION_REVISION],${VERSION_REVISION}, [version revision number])
 AC_DEFINE_UNQUOTED([PACKAGE_VERSION_EXTRA],${VERSION_EXTRA}, [version extra number])
 AC_DEFINE_UNQUOTED([PACKAGE_VERSION_DEV],"${VERSION_DEV}", [version development string])
+AC_DEFINE_UNQUOTED([LIBVLC_ABI_MAJOR],${LIBVLC_ABI_MAJOR}, [libvlc version major number])
+AC_DEFINE_UNQUOTED([LIBVLC_ABI_MINOR],${LIBVLC_ABI_MINOR}, [libvlc version minor number])
+AC_DEFINE_UNQUOTED([LIBVLC_ABI_MICRO],${LIBVLC_ABI_MICRO}, [libvlc version micro number])
 AC_SUBST([COPYRIGHT_MESSAGE])
 AC_SUBST([VERSION_MESSAGE])
 AC_SUBST([VERSION_MAJOR])


=====================================
include/vlc/libvlc_version.h.in → include/vlc/libvlc_version.h
=====================================
@@ -33,13 +33,13 @@
 # define LIBVLC_VERSION_H 1
 
 /** LibVLC major version number */
-# define LIBVLC_VERSION_MAJOR    (@VERSION_MAJOR@)
+# define LIBVLC_VERSION_MAJOR    (4)
 
 /** LibVLC minor version number */
-# define LIBVLC_VERSION_MINOR    (@VERSION_MINOR@)
+# define LIBVLC_VERSION_MINOR    (0)
 
 /** LibVLC revision */
-# define LIBVLC_VERSION_REVISION (@VERSION_REVISION@)
+# define LIBVLC_VERSION_REVISION (0)
 
 # define LIBVLC_VERSION_EXTRA    (0)
 
@@ -54,13 +54,13 @@
 
 
 /** LibVLC ABI major version number, updated when incompatible changes are added */
-# define LIBVLC_ABI_VERSION_MAJOR  (@LIBVLC_ABI_MAJOR@)
+# define LIBVLC_ABI_VERSION_MAJOR  (12)
 
 /** LibVLC ABI minor version number, updated when compatible changes are added */
-# define LIBVLC_ABI_VERSION_MINOR  (@LIBVLC_ABI_MINOR@)
+# define LIBVLC_ABI_VERSION_MINOR  (0)
 
 /** LibVLC ABI micro version number, updated with new releases */
-# define LIBVLC_ABI_VERSION_MICRO  (@LIBVLC_ABI_MICRO@)
+# define LIBVLC_ABI_VERSION_MICRO  (0)
 
 /** LibVLC full ABI version combining the major VLC version and the .so version:
  * - A 0xFF000000 mask gives the VLC major version,


=====================================
lib/Makefile.am
=====================================
@@ -20,14 +20,9 @@ pkginclude_HEADERS = \
 	../include/vlc/libvlc_media_track.h \
 	../include/vlc/libvlc_renderer_discoverer.h \
 	../include/vlc/libvlc_picture.h \
+	../include/vlc/libvlc_version.h \
 	../include/vlc/vlc.h
 
-nodist_pkginclude_HEADERS = ../include/vlc/libvlc_version.h
-
-../include/vlc/libvlc_version.h: ../include/vlc/libvlc_version.h.in $(top_builddir)/config.status
-	$(AM_V_GEN)cd "$(top_builddir)" && \
-	$(SHELL) ./config.status --file="src/$@"
-
 lib_LTLIBRARIES = libvlc.la
 
 libvlc_la_SOURCES = \
@@ -55,7 +50,7 @@ libvlc_la_SOURCES = \
 	media_discoverer.c \
 	picture.c \
 	../src/revision.c
-EXTRA_DIST = libvlc.pc.in libvlc.sym ../include/vlc/libvlc_version.h.in
+EXTRA_DIST = libvlc.pc.in libvlc.sym
 
 if HAVE_WIN32
 noinst_DATA = libvlc_win32_rc.rc


=====================================
lib/core.c
=====================================
@@ -34,6 +34,14 @@
 #include <limits.h>
 #include <assert.h>
 
+static_assert(LIBVLC_VERSION_MAJOR    == PACKAGE_VERSION_MAJOR, "Major VLC version mismatch");
+static_assert(LIBVLC_VERSION_MINOR    == PACKAGE_VERSION_MINOR, "Minor VLC version mismatch");
+static_assert(LIBVLC_VERSION_REVISION == PACKAGE_VERSION_REVISION, "VLC Revision version mismatch");
+static_assert(LIBVLC_VERSION_EXTRA    == PACKAGE_VERSION_EXTRA, "VLC Extra version mismatch");
+static_assert(LIBVLC_ABI_VERSION_MAJOR == LIBVLC_ABI_MAJOR, "Major LibVLC version mismatch");
+static_assert(LIBVLC_ABI_VERSION_MINOR == LIBVLC_ABI_MINOR, "Minor LibVLC version mismatch");
+static_assert(LIBVLC_ABI_VERSION_MICRO == LIBVLC_ABI_MICRO, "Micro LibVLC version mismatch");
+
 int libvlc_abi_version(void)
 {
     return LIBVLC_ABI_VERSION_INT;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/92efc846014b17b70dfa44d0666ba328e2ee2680

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/92efc846014b17b70dfa44d0666ba328e2ee2680
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list