From 8505f1429d5a00eb99ece1ae33354c353911e445 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 26 Mar 2008 19:33:06 +0100 Subject: [PATCH] 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(-) delete mode 100644 loader/.gitignore diff --git a/include/wine/library.h b/include/wine/library.h index 2c3b7bbe1b3..0c603789665 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 ff27f54c4da..b332749eef8 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 11278b743a4..ea74396fac3 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-@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 eb187e5840b..9e33f4eab44 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 63041131196..dc5f853df7b 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 ef8d823f627..2159fac852b 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 b0470638e83..00000000000 --- a/loader/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/version-stamp -/version.c diff --git a/loader/Makefile.in b/loader/Makefile.in index 64695fedf79..3179e2211a9 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-@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 5e0f330caa4..0a1afbb6dfa 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); } } -- 2.11.4.GIT