* We do now have a special "_haiku_revision" section in our libroot,
containing the Haiku SVN revision number which is used by uname(). The value is 0 when built, but updated by the build system before copying libroot to the image (new rule CopySetHaikuRevision). * For AboutHaiku we no longer write the SVN revision number into a resource. Instead we use the uname() info. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20082 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6b533670b9
commit
a4e0c1d43d
@ -217,3 +217,35 @@ rule ObjectReferences
|
||||
}
|
||||
}
|
||||
|
||||
rule CopySetHaikuRevision target : source
|
||||
{
|
||||
# CopySetHaikuRevision <target> : <source>
|
||||
#
|
||||
# Copy <source> to <target>, writing the SVN revision of the working root
|
||||
# directory into the haiku revision section of <target>.
|
||||
#
|
||||
# <target> - Output file target. Gristed and located target.
|
||||
# <source> - ELF object to be copied. Gristed and located target.
|
||||
|
||||
# If existent, make the target depend on the .svn/entries file in the
|
||||
# root directory, so it gets updated when the revision changes due to
|
||||
# "svn up".
|
||||
if [ Glob [ FDirName $(HAIKU_TOP) .svn ] : entries ] {
|
||||
local svnEntries = <haiku-rootdir-svn>entries ;
|
||||
SEARCH on $(svnEntries) = [ FDirName $(HAIKU_TOP) .svn ] ;
|
||||
Depends $(target) : $(svnEntries) ;
|
||||
}
|
||||
|
||||
Depends $(target) : <build>copyattr <build>set_haiku_revision $(source) ;
|
||||
CopySetHaikuRevision1 $(target)
|
||||
: <build>copyattr <build>set_haiku_revision $(source) ;
|
||||
}
|
||||
|
||||
actions CopySetHaikuRevision1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
revision=`(svn info $(HAIKU_TOP) 2> /dev/null || echo Revision: 0) |
|
||||
grep Revision | awk '{printf $2}'`
|
||||
$(2[1]) --data $(2[3]) $(1) &&
|
||||
$(2[2]) $(1) ${revision}
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ BEOS_DEMOS = BitmapDrawing Chart $(X86_ONLY)GLTeapot PictureTest Playground
|
||||
BEOS_SYSTEM_LIB = libbe.so $(HAIKU_LIBSTDC++) libmedia.so libtracker.so
|
||||
libtranslation.so libnetwork.so libdebug.so libbsd.so libmail.so
|
||||
libtextencoding.so libz.so libfreetype.so libpng.so libmidi.so libmidi2.so
|
||||
libdevice.so libgame.so libscreensaver.so libroot.so $(X86_ONLY)libGL.so
|
||||
libfluidsynth.so libqoca.so
|
||||
libdevice.so libgame.so libscreensaver.so <revisioned>libroot.so
|
||||
$(X86_ONLY)libGL.so libfluidsynth.so libqoca.so
|
||||
;
|
||||
BEOS_SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server net_server
|
||||
media_addon_server input_server app_server fake_app_server midi_server print_server
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
|
||||
#define SCROLL_CREDITS_VIEW 'mviv'
|
||||
@ -178,18 +179,17 @@ AboutView::AboutView(const BRect &rect)
|
||||
strcpy(string, versionInfo.short_info);
|
||||
}
|
||||
|
||||
// Add revision from resources
|
||||
BResources* resources = be_app->AppResources();
|
||||
char version[32];
|
||||
size_t size;
|
||||
const char* versionResource = (const char *)resources->LoadResource(
|
||||
B_STRING_TYPE, "SVN:REVISION", &size);
|
||||
if (versionResource != NULL)
|
||||
strlcpy(version, versionResource, min_c(size + 1, sizeof(version)));
|
||||
if (versionResource != NULL && strcmp(version, "unknown") != 0) {
|
||||
strlcat(string, " (Revision ", sizeof(string));
|
||||
strlcat(string, version, sizeof(string));
|
||||
strlcat(string, ")", sizeof(string));
|
||||
// Add revision from uname() info
|
||||
utsname unameInfo;
|
||||
if (uname(&unameInfo) == 0) {
|
||||
long revision;
|
||||
if (sscanf(unameInfo.version, "r%ld", &revision) == 1) {
|
||||
char version[16];
|
||||
snprintf(version, sizeof(version), "%ld", revision);
|
||||
strlcat(string, " (Revision ", sizeof(string));
|
||||
strlcat(string, version, sizeof(string));
|
||||
strlcat(string, ")", sizeof(string));
|
||||
}
|
||||
}
|
||||
|
||||
stringView = new BStringView(r, "ostext", string);
|
||||
|
@ -6,25 +6,6 @@ if $(TARGET_PLATFORM) = r5 {
|
||||
SubDirC++Flags -DR5_COMPATIBLE ;
|
||||
}
|
||||
|
||||
rule GenerateRevisionFile
|
||||
{
|
||||
MakeLocateCommonPlatform $(1) ;
|
||||
Always $(1) ;
|
||||
# we want to rebuild the resources everytime AboutHaiku
|
||||
# is built to keep them up-to-date
|
||||
}
|
||||
|
||||
actions GenerateRevisionFile
|
||||
{
|
||||
(svn info $(HAIKU_TOP) 2> /dev/null || echo Revision: unknown) |
|
||||
grep Revision | awk '{printf $2}' > $(1)
|
||||
}
|
||||
|
||||
local revisionFile = [ FGristFiles haiku-revision ] ;
|
||||
GenerateRevisionFile $(revisionFile) ;
|
||||
|
||||
AddFileDataResource AboutHaiku : CSTR:201:SVN:REVISION : $(revisionFile) ;
|
||||
|
||||
Application AboutHaiku :
|
||||
AboutHaiku.cpp
|
||||
: libbe.so libtranslation.so libroot.so
|
||||
|
@ -48,5 +48,16 @@ SharedLibrary libroot.so
|
||||
$(librootObjects:G=nogrist)
|
||||
;
|
||||
|
||||
|
||||
# Copy libroot.so and update the copy's revision section. We link everything
|
||||
# against the original, but the copy will end up on the disk image (this way
|
||||
# we avoid unnecessary dependencies). The copy will be located in a subdirectory.
|
||||
if $(TARGET_PLATFORM) = haiku {
|
||||
MakeLocate <revisioned>libroot.so
|
||||
: [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ;
|
||||
CopySetHaikuRevision <revisioned>libroot.so : libroot.so ;
|
||||
}
|
||||
|
||||
|
||||
SubInclude HAIKU_TOP src system libroot os ;
|
||||
SubInclude HAIKU_TOP src system libroot posix ;
|
||||
|
@ -12,6 +12,12 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// Haiku SVN revision. Will be set when copying libroot.so to the image.
|
||||
// Lives in a separate section so that it can easily be found.
|
||||
extern uint32 _gHaikuRevision __attribute__((section("_haiku_revision")));
|
||||
uint32 _gHaikuRevision = 0;
|
||||
|
||||
|
||||
int
|
||||
uname(struct utsname *info)
|
||||
{
|
||||
@ -28,13 +34,15 @@ uname(struct utsname *info)
|
||||
strlcpy(info->sysname, "Haiku", sizeof(info->sysname));
|
||||
|
||||
info->version[0] = '\0';
|
||||
#ifdef HAIKU_REVISION
|
||||
snprintf(info->version, sizeof(info->version), "r%d ", HAIKU_REVISION);
|
||||
#endif
|
||||
if (_gHaikuRevision) {
|
||||
snprintf(info->version, sizeof(info->version), "r%ld ",
|
||||
_gHaikuRevision);
|
||||
}
|
||||
strlcat(info->version, systemInfo.kernel_build_date, sizeof(info->version));
|
||||
strlcat(info->version, " ", sizeof(info->version));
|
||||
strlcat(info->version, systemInfo.kernel_build_time, sizeof(info->version));
|
||||
snprintf(info->release, sizeof(info->release), "%lld", systemInfo.kernel_version);
|
||||
snprintf(info->release, sizeof(info->release), "%lld",
|
||||
systemInfo.kernel_version);
|
||||
|
||||
// TODO: make this better
|
||||
switch (systemInfo.platform_type) {
|
||||
|
Loading…
Reference in New Issue
Block a user