-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConstruct
More file actions
80 lines (64 loc) · 1.91 KB
/
SConstruct
File metadata and controls
80 lines (64 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!python
import os
import sys
CFLAGS_WARNING = " ".join([
"-Wall",
"-Wextra",
"-Wfloat-equal",
"-Wundef",
"-Wshadow",
"-Wpointer-arith",
"-Wcast-align",
"-Wstrict-prototypes",
"-Wwrite-strings",
"-Waggregate-return",
"-Wcast-qual",
"-Wswitch-default",
"-Wswitch-enum",
"-Wconversion",
"-Wunreachable-code",
"-Wformat=2",
"-Werror-implicit-function-declaration"
])
# SConstruct Environments
env = Environment()
env.Append(LINKFLAGS = "-std=c99 -ansi")
env.Append(CFLAGS = CFLAGS_WARNING)
env.Append(CFLAGS = "-isystem third-party")
env.ParseConfig("pkg-config --cflags --libs libxfce4panel-2.0 libxfce4ui-2")
# Command Line Variables
opts = Variables("xfce4-watson-plugin.conf", ARGUMENTS)
opts.Add(PathVariable("PREFIX", "Directory to install under", "/usr", PathVariable.PathIsDir))
opts.Update(env)
# Help Text
Help(opts.GenerateHelpText(env))
# Installation Paths
idir_prefix = '${PREFIX}'
idir_data = "${PREFIX}/share"
idir_lib = "${PREFIX}/lib"
idir_icon = "${PREFIX}/local/share"
wdir_data = os.path.join(idir_data, "xfce4", "watson")
# Defines
env.Append(CPPDEFINES = "WATSON_DATADIR=\\\"" + wdir_data + "\\\"")
# Build Plugin
src_files = Glob("src/*.c")
libwatson = env.SharedLibrary("watson", src_files)
# Install
env.Install(
os.path.join(idir_lib, "xfce4", "panel-plugins"),
libwatson)
env.Install(
os.path.join(idir_data, "xfce4", "panel", "plugins"),
"#resources/watson.desktop")
env.Install(wdir_data, Glob("#resources/data/*"))
for icon in Glob("#resources/icons/*/*", strings=True):
index_lo = icon.find("/icons/") + len("/icons/")
index_hi = icon.rfind("/")
icon_size = icon[index_lo:index_hi]
icon_name = icon[index_hi+1:]
dest = os.path.join(idir_icon, "icons", "hicolor", icon_size, "apps", icon_name)
env.InstallAs(dest, icon)
env.AddPostAction(
dest,
"gtk-update-icon-cache -f -t " + os.path.join(idir_icon, "icons", "hicolor"))
env.Alias("install", idir_prefix)