diff --git a/Makefile b/Makefile index 3c6fb76..ff40645 100644 --- a/Makefile +++ b/Makefile @@ -49,8 +49,7 @@ else CXXFLAGS := -pipe -O2 -fno-rtti -fno-exceptions -DNDEBUG endif -CFLAGS+=-DVERSION=\"$(VERSION)\" \ - -DINSTALL_PREFIX=\"$(prefix)\" \ +CFLAGS+=-DINSTALL_PREFIX=\"$(prefix)\" \ -DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \ -DDOCUMENT_PATH=\"$(DOCUMENT_PATH)\" @@ -102,7 +101,9 @@ DONE:=$(BOLD)$(GREEN)done$(SGR0) non-sequencer: $(OBJS) @ echo -n "Linking..." @ rm -f $@ - @ $(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) -o $@ || echo "$(BOLD)$(RED)Error!$(SGR0)" + @ scripts/build_id .version.c $(VERSION) + @ $(CXX) -c .version.c + @ $(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) .version.o -o $@ || echo "$(BOLD)$(RED)Error!$(SGR0)" @ if test -x $@; then echo "$(DONE)"; test -x "$(prefix)/bin/$@" || echo "You must now run 'make install' (as the appropriate user) to install the executable, documentation and other support files in order for the program to function properly."; fi install: all diff --git a/scripts/build_id b/scripts/build_id new file mode 100755 index 0000000..dae4afa --- /dev/null +++ b/scripts/build_id @@ -0,0 +1,34 @@ +#!/bin/sh + +# Copyright (C) 2008 Jonathan Moore Liles # +# # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the # +# Free Software Foundation; either version 2 of the License, or (at your # +# option) any later version. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with This program; see the file COPYING. If not,write to the Free Software # +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # + +if [ -d .git ] +then + ID="`[ \`git rev-parse HEAD\` = \`git rev-parse v${2}\` ] || git rev-parse --short HEAD`" + if [ -n "$ID" ] + then + ID="git {$ID}" + else + ID="git" + fi +else + ID="dist" +fi + +echo "/* generated file */" > "$1" +echo "const char *BUILD_ID = \"${ID}\";" >> "$1" +echo "const char *VERSION = \"${2}\";" >> "$1" diff --git a/src/gui/ui.fl b/src/gui/ui.fl index 8b7ee63..36e1cdf 100644 --- a/src/gui/ui.fl +++ b/src/gui/ui.fl @@ -37,6 +37,11 @@ decl {\#include "../jack.H"} {} decl {\#include "../lash.H"} {} +decl {extern const char *BUILD_ID;} {} + +decl {extern const char *VERSION;} {selected +} + decl {extern UI *ui;} {} decl {class O_Canvas;} {} @@ -1011,21 +1016,21 @@ detach_button->value( 0 );} open } { Fl_Window about_popup { label About open - xywh {626 238 535 605} type Single non_modal size_range {539 608 539 608} visible + xywh {697 224 535 620} type Single non_modal size_range {539 608 539 608} visible } { Fl_Box {} { label VERSION - xywh {10 29 515 209} + xywh {10 16 515 228} box ROUNDED_BOX code0 {o->label( VERSION );} code1 {o->image( Fl_Shared_Image::get( DOCUMENT_PATH "/logo.png" ) );} code2 {o->redraw();} } Fl_Group {} {open - xywh {26 272 488 272} box ROUNDED_BOX color 51 + xywh {26 286 488 272} box ROUNDED_BOX color 51 } { Fl_Box {} { label {Copyright (C) 2007-2008 Jonathan Moore Liles} - xywh {26 272 488 32} labeltype SHADOW_LABEL labelfont 1 labelsize 18 + xywh {26 286 488 32} labeltype SHADOW_LABEL labelfont 1 labelsize 18 } Fl_Box {} { label {This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. @@ -1033,7 +1038,7 @@ detach_button->value( 0 );} open This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.} - xywh {41 311 463 233} labelfont 1 labelsize 12 align 144 + xywh {41 325 463 233} labelfont 1 labelsize 12 align 144 } } Fl_Button {} { @@ -1044,12 +1049,17 @@ You should have received a copy of the GNU General Public License along with thi \#else fl_open_uri( "http://non.tuxfamily.org" ); \#endif} - xywh {178 554 188 30} color 14 labeltype SHADOW_LABEL labelcolor 6 + xywh {178 568 188 30} color 14 labeltype SHADOW_LABEL labelcolor 6 } Fl_Return_Button {} { label rock callback {about_popup->hide();} - xywh {453 570 78 31} + xywh {453 584 78 31} + } + Fl_Box {} { + label label + xywh {191 262 153 22} color 51 labelfont 4 labelcolor 52 + code2 {o->label( BUILD_ID );} } } } @@ -1294,8 +1304,7 @@ help->show(); } } -return true;} {selected - } +return true;} {} } Function {switch_to_pattern( int n )} {return_type void } { diff --git a/src/main.C b/src/main.C index 3ad377c..21af1fa 100644 --- a/src/main.C +++ b/src/main.C @@ -30,7 +30,8 @@ #include "pattern.H" #include "phrase.H" - +extern const char *BUILD_ID; +extern const char *VERSION; Canvas *pattern_c, *phrase_c, *trigger_c; @@ -152,7 +153,7 @@ main ( int argc, char **argv ) asprintf( &config.user_config_dir, "%s/%s", getenv( "HOME" ), USER_CONFIG_DIR ); mkdir( config.user_config_dir, 0777 ); - printf( "%s %s -- %s\n", APP_TITLE, VERSION, COPYRIGHT ); + printf( "%s %s %s -- %s\n", APP_TITLE, VERSION, BUILD_ID, COPYRIGHT ); playlist = new sequence;