Alexandre Julliard : libwine: Export functions that return the Wine version number and build id.

Alexandre Julliard julliard at winehq.org
Thu Mar 27 07:21:49 CDT 2008


Module: wine
Branch: master
Commit: 8505f1429d5a00eb99ece1ae33354c353911e445
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8505f1429d5a00eb99ece1ae33354c353911e445

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Mar 26 19:33:06 2008 +0100

libwine: Export functions that return the Wine version number and build id.

---

 include/wine/library.h |    2 ++
 libs/.gitignore        |    2 ++
 libs/wine/Makefile.in  |   10 +++++++++-
 libs/wine/config.c     |   13 +++++++++++++
 libs/wine/wine.def     |    2 ++
 libs/wine/wine.map     |    2 ++
 loader/.gitignore      |    2 --
 loader/Makefile.in     |   13 ++-----------
 loader/main.c          |    3 +--
 9 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/include/wine/library.h b/include/wine/library.h
index 2c3b7bb..0c60378 100644
--- a/include/wine/library.h
+++ b/include/wine/library.h
@@ -38,6 +38,8 @@ extern const char *wine_get_config_dir(void);
 extern const char *wine_get_data_dir(void);
 extern const char *wine_get_server_dir(void);
 extern const char *wine_get_user_name(void);
+extern const char *wine_get_version(void);
+extern const char *wine_get_build_id(void);
 extern void wine_init_argv0_path( const char *argv0 );
 extern void wine_exec_wine_binary( const char *name, char **argv, const char *env_var );
 
diff --git a/libs/.gitignore b/libs/.gitignore
index ff27f54..b332749 100644
--- a/libs/.gitignore
+++ b/libs/.gitignore
@@ -1,2 +1,4 @@
 *.dylib
 *.so.*
+wine/version-stamp
+wine/version.c
diff --git a/libs/wine/Makefile.in b/libs/wine/Makefile.in
index 11278b7..ea74396 100644
--- a/libs/wine/Makefile.in
+++ b/libs/wine/Makefile.in
@@ -96,6 +96,8 @@ C_SRCS = \
 	c_28605.c \
 	c_28606.c
 
+EXTRA_OBJS = version.o
+
 all: $(MODULE) $(MODULE:.dll=.a)
 
 @MAKE_RULES@
@@ -173,8 +175,14 @@ uninstall::
 	-cd $(DESTDIR)$(libdir) && $(RM) libwine.a libwine.dll libwine.so libwine.so.$(VERSION) \
 		libwine.so.$(SOVERSION) libwine.dylib libwine.$(VERSION).dylib libwine.$(SOVERSION).dylib
 
+version-stamp: dummy
+	(GIT_DIR=$(TOPSRCDIR)/.git git describe HEAD 2>/dev/null || echo "wine- at PACKAGE_VERSION@") | sed -e 's/\(.*\)/const char wine_build[] = "\1";/' >$@ || ($(RM) $@ && exit 1)
+
+version.c: version-stamp
+	@cmp -s version-stamp $@ || cp version-stamp $@
+
 clean::
-	$(RM) libwine.so.$(SOVERSION) libwine.so.$(VERSION)
+	$(RM) libwine.so.$(SOVERSION) libwine.so.$(VERSION) version.c version-stamp
 
 $(RELPATH):
 	@cd $(TOOLSDIR)/tools && $(MAKE) relpath
diff --git a/libs/wine/config.c b/libs/wine/config.c
index eb187e5..9e33f4e 100644
--- a/libs/wine/config.c
+++ b/libs/wine/config.c
@@ -407,6 +407,19 @@ const char *wine_get_user_name(void)
     return user_name;
 }
 
+/* return the standard version string */
+const char *wine_get_version(void)
+{
+    return PACKAGE_VERSION;
+}
+
+/* return the build id string */
+const char *wine_get_build_id(void)
+{
+    extern const char wine_build[];
+    return wine_build;
+}
+
 /* exec a binary using the preloader if requested; helper for wine_exec_wine_binary */
 static void preloader_exec( char **argv, int use_preloader )
 {
diff --git a/libs/wine/wine.def b/libs/wine/wine.def
index 6304113..dc5f853 100644
--- a/libs/wine/wine.def
+++ b/libs/wine/wine.def
@@ -77,6 +77,7 @@ EXPORTS
     wine_exec_wine_binary
     wine_fold_string
     wine_get_build_dir
+    wine_get_build_id
     wine_get_config_dir
     wine_get_cs
     wine_get_data_dir
@@ -88,6 +89,7 @@ EXPORTS
     wine_get_sortkey
     wine_get_ss
     wine_get_user_name
+    wine_get_version
     wine_init
     wine_init_argv0_path
     wine_is_dbcs_leadbyte
diff --git a/libs/wine/wine.map b/libs/wine/wine.map
index ef8d823..2159fac 100644
--- a/libs/wine/wine.map
+++ b/libs/wine/wine.map
@@ -77,6 +77,7 @@ WINE_1.0
     wine_exec_wine_binary;
     wine_fold_string;
     wine_get_build_dir;
+    wine_get_build_id;
     wine_get_config_dir;
     wine_get_cs;
     wine_get_data_dir;
@@ -88,6 +89,7 @@ WINE_1.0
     wine_get_sortkey;
     wine_get_ss;
     wine_get_user_name;
+    wine_get_version;
     wine_init;
     wine_init_argv0_path;
     wine_is_dbcs_leadbyte;
diff --git a/loader/.gitignore b/loader/.gitignore
deleted file mode 100644
index b047063..0000000
--- a/loader/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/version-stamp
-/version.c
diff --git a/loader/Makefile.in b/loader/Makefile.in
index 64695fe..3179e22 100644
--- a/loader/Makefile.in
+++ b/loader/Makefile.in
@@ -12,8 +12,8 @@ C_SRCS = \
 	preloader.c \
 	pthread.c
 
-KTHREAD_OBJS = kthread.o main.o version.o
-PTHREAD_OBJS = pthread.o main.o version.o
+KTHREAD_OBJS = kthread.o main.o
+PTHREAD_OBJS = pthread.o main.o
 
 MAIN_BINARY    = @MAIN_BINARY@
 EXTRA_BINARIES = @EXTRA_BINARIES@
@@ -97,13 +97,4 @@ uninstall::
 	$(RM) $(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext)/wine.$(prog_manext)
 	$(RM) $(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)/wine.$(prog_manext)
 
-clean::
-	$(RM) version.c version-stamp
-
-version-stamp: dummy
-	(GIT_DIR=$(TOPSRCDIR)/.git git-describe HEAD 2>/dev/null || echo "wine- at PACKAGE_VERSION@") | sed -e 's/\(.*\)/const char wine_version[] = "\1";/' >$@ || ($(RM) $@ && exit 1)
-
-version.c: version-stamp
-	@cmp -s version-stamp $@ || cp version-stamp $@
-
 @DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/loader/main.c b/loader/main.c
index 5e0f330..0a1afbb 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -68,7 +68,6 @@ static inline void reserve_area( void *addr, size_t size )
  */
 static void check_command_line( int argc, char *argv[] )
 {
-    extern const char wine_version[];
     static const char usage[] =
         "Usage: wine PROGRAM [ARGUMENTS...]   Run the specified program\n"
         "       wine --help                   Display this help and exit\n"
@@ -86,7 +85,7 @@ static void check_command_line( int argc, char *argv[] )
     }
     if (!strcmp( argv[1], "--version" ))
     {
-        printf( "%s\n", wine_version );
+        printf( "%s\n", wine_get_build_id() );
         exit(0);
     }
 }




More information about the wine-cvs mailing list