Skip to content

Commit

Permalink
build with custom resource path:
Browse files Browse the repository at this point in the history
scons APP_RES="/usr/share/gnome-arcade"
  • Loading branch information
strippat committed Aug 12, 2014
1 parent f712148 commit 7dcfa25
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
2 changes: 0 additions & 2 deletions gnome-arcade.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ Categories=GNOME;GTK;Game;ArcadeGame;Emulator;
StartupNotify=true
Keywords=mame;emulator;frontend;games;
Keywords[it]=mame;emulatore;frontend;giochi;
Path=/usr/share/gnome-arcade/


X-Desktop-File-Install-Version=0.22
7 changes: 5 additions & 2 deletions header/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@
#define APP_WEB "https://github.com/strippato"
#define APP_GNU_WARN "You should have received a copy of the GNU GPL along with gnome-arcade.\n"\
"If not, see <http://www.gnu.org/licenses/>."

#define APP_RESOURCE "res/"
#ifndef APP_RES
#define APP_RESOURCE "./res/"
#else
#define APP_RESOURCE APP_RES "/res/"
#endif
#define APP_DIRCONFIG "gnome-arcade"
#define APP_CSS "gnome-arcade.css"

Expand Down
Binary file modified res/gnome-arcade-about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 18 additions & 4 deletions sconstruct
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Help("""
Type:
'scons' to build the production program (default resource path: ".")

'scons APP_RES="/my/new/root/path"' to specify a custom resource path
ex: scons APP_RES="/usr/share/gnome-arcade"
""")

#debug
#CCFLAGS = '-std=c99 -Wpedantic -Wall -Wformat -Wformat-security -Wunused-result `pkg-config --cflags gtk+-3.0` -g3'

Expand All @@ -8,11 +16,17 @@ CCFLAGS = '-std=c99 -Wall `pkg-config --cflags gtk+-3.0` -g -O2 -march=native'
#fast & buggy
#CCFLAGS = '-std=c99 -Wall `pkg-config --cflags gtk+-3.0` -O3 -march=native'

LINKFLAGS = '`pkg-config --libs gtk+-3.0`'
CPPPATH = 'header'
SOURCE = Split ('./src/app.c ./src/ui.c ./src/mame.c ./src/rom.c ./src/util.c ./src/pref.c ./src/www.c ./src/view.c ./src/config.c')
vars = Variables()
#vars.Add(PathVariable('APP_RES', 'Resource root of gnome-arcade: /usr/share/gnome-arcade', '/usr/share/gnome-arcade', PathVariable.PathAccept))
vars.Add(PathVariable('APP_RES', 'Resource root of gnome-arcade: /usr/share/gnome-arcade', ".", PathVariable.PathAccept))


LINKFLAGS = '`pkg-config --libs gtk+-3.0`'
CPPPATH = 'header'
SOURCE = Glob ('./src/*c')

env = Environment (CCFLAGS=CCFLAGS, LINKFLAGS=LINKFLAGS, CPPPATH=CPPPATH)
#env = Environment (CCFLAGS=CCFLAGS, LINKFLAGS=LINKFLAGS, CPPPATH=CPPPATH)
env = Environment (variables = vars, CPPDEFINES={'APP_RES' : '\\"$APP_RES\\"'}, CCFLAGS=CCFLAGS, LINKFLAGS=LINKFLAGS, CPPPATH=CPPPATH)

t = env.Program (target='gnome-arcade', source=SOURCE)

Expand Down
3 changes: 2 additions & 1 deletion src/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const gchar *app_authors[] = { "Strippato <[email protected]>",
NULL };

const gchar *app_artists[] = { "Strippato <[email protected]>",
"Sergio Gridelli <[email protected]> \"The Fox\" &amp; \"Zio Bosi\" seal of quality logo",
"Sergio Gridelli <[email protected]> \"The Fox\"® &amp; \"Zio Bosi\"® seal of quality logo",
"Sergio Gridelli <[email protected]> \"Gallo UNSUPPORTED\"® logo",
NULL };

GtkApplication *app_application;
Expand Down
2 changes: 2 additions & 0 deletions src/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,8 @@ ui_init (void)
ui_view = 0;
ui_mouseOver = -1;

g_print ("resource path is %s\n", APP_RESOURCE);

/* CSS */
GtkCssProvider* cssProvider = gtk_css_provider_new ();
GdkDisplay* display = gdk_display_get_default ();
Expand Down

0 comments on commit 7dcfa25

Please sign in to comment.