summaryrefslogtreecommitdiff
path: root/framebuffer/Makefile.target
blob: 699c8da80203b44aaa663ee7e073d80105718a4a (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# ----------------------------------------------------------------------------
# Framebuffer target setup
# ----------------------------------------------------------------------------

$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng)  ))

ifeq ($(NETSURF_FB_FONTLIB),freetype)
  CFLAGS += -DFB_USE_FREETYPE $(shell freetype-config --cflags)
  LDFLAGS += $(shell freetype-config --libs)
endif

# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
NETSURF_FEATURE_HUBBUB_CFLAGS := -DWITH_HUBBUB
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0
NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0

CFLAGS += -Dnsframebuffer 

#resource path
CFLAGS += '-DNETSURF_FB_RESPATH="$(NETSURF_FB_RESPATH)"'

# compile time font locations
CFLAGS += '-DNETSURF_FB_FONTPATH="$(NETSURF_FB_FONTPATH)"'
CFLAGS += '-DNETSURF_FB_FONT_SANS_SERIF="$(NETSURF_FB_FONT_SANS_SERIF)"'
CFLAGS += '-DNETSURF_FB_FONT_SANS_SERIF_BOLD="$(NETSURF_FB_FONT_SANS_SERIF_BOLD)"'
CFLAGS += '-DNETSURF_FB_FONT_SANS_SERIF_ITALIC="$(NETSURF_FB_FONT_SANS_SERIF_ITALIC)"'
CFLAGS += '-DNETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD="$(NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD)"'
CFLAGS += '-DNETSURF_FB_FONT_SERIF="$(NETSURF_FB_FONT_SERIF)"'
CFLAGS += '-DNETSURF_FB_FONT_SERIF_BOLD="$(NETSURF_FB_FONT_SERIF_BOLD)"'
CFLAGS += '-DNETSURF_FB_FONT_MONOSPACE="$(NETSURF_FB_FONT_MONOSPACE)"'
CFLAGS += '-DNETSURF_FB_FONT_MONOSPACE_BOLD="$(NETSURF_FB_FONT_MONOSPACE_BOLD)"'
CFLAGS += '-DNETSURF_FB_FONT_CURSIVE="$(NETSURF_FB_FONT_CURSIVE)"'
CFLAGS += '-DNETSURF_FB_FONT_FANTASY="$(NETSURF_FB_FONT_FANTASY)"'

$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript))

CFLAGS += -std=c99 -g -Dsmall \
	  -D_BSD_SOURCE \
	  -D_XOPEN_SOURCE=600 \
	  -D_POSIX_C_SOURCE=200112L \
	  $(shell $(PKG_CONFIG) --cflags libnsfb libhubbub libcss openssl)

LDFLAGS += -lm -Wl,--whole-archive $(shell $(PKG_CONFIG) --libs libnsfb) -Wl,--no-whole-archive 

ifeq ($(HOST),mint)
    # freemint does not support pkg-config for libcurl
    CFLAGS += $(shell curl-config --cflags)

    LDFLAGS += $(shell curl-config --libs)
    LDFLAGS += $(shell $(PKG_CONFIG) --libs libhubbub openssl libcss)
    LDFLAGS += -L/usr/lib/ -lz -liconv 
    LDFLAGS += -lm
else
    CFLAGS += $(shell $(PKG_CONFIG) --cflags libcurl)

    LDFLAGS += $(shell $(PKG_CONFIG) --libs libcurl libdom openssl)
    LDFLAGS += $(shell $(PKG_CONFIG) --libs libcss)
endif


# ----------------------------------------------------------------------------
# built-in resource setup
# ----------------------------------------------------------------------------


FB_IMAGE_left_arrow := framebuffer/res/icons/back.png
FB_IMAGE_right_arrow := framebuffer/res/icons/forward.png
FB_IMAGE_reload := framebuffer/res/icons/reload.png
FB_IMAGE_stop_image := framebuffer/res/icons/stop.png
FB_IMAGE_history_image := framebuffer/res/icons/history.png

FB_IMAGE_left_arrow_g := framebuffer/res/icons/back_g.png
FB_IMAGE_right_arrow_g := framebuffer/res/icons/forward_g.png
FB_IMAGE_reload_g := framebuffer/res/icons/reload_g.png
FB_IMAGE_stop_image_g := framebuffer/res/icons/stop_g.png
FB_IMAGE_history_image_g := framebuffer/res/icons/history_g.png

FB_IMAGE_scrolll := framebuffer/res/icons/scrolll.png
FB_IMAGE_scrollr := framebuffer/res/icons/scrollr.png
FB_IMAGE_scrollu := framebuffer/res/icons/scrollu.png
FB_IMAGE_scrolld := framebuffer/res/icons/scrolld.png

FB_IMAGE_osk_image := framebuffer/res/icons/osk.png

FB_IMAGE_pointer_image := framebuffer/res/pointers/default.png
FB_IMAGE_hand_image := framebuffer/res/pointers/point.png
FB_IMAGE_caret_image := framebuffer/res/pointers/caret.png
FB_IMAGE_menu_image := framebuffer/res/pointers/menu.png
FB_IMAGE_progress_image := framebuffer/res/pointers/progress.png
FB_IMAGE_move_image := framebuffer/res/pointers/move.png

FB_IMAGE_throbber0 := framebuffer/res/throbber/throbber0.png
FB_IMAGE_throbber1 := framebuffer/res/throbber/throbber1.png
FB_IMAGE_throbber2 := framebuffer/res/throbber/throbber2.png
FB_IMAGE_throbber3 := framebuffer/res/throbber/throbber3.png
FB_IMAGE_throbber4 := framebuffer/res/throbber/throbber4.png
FB_IMAGE_throbber5 := framebuffer/res/throbber/throbber5.png
FB_IMAGE_throbber6 := framebuffer/res/throbber/throbber6.png
FB_IMAGE_throbber7 := framebuffer/res/throbber/throbber7.png
FB_IMAGE_throbber8 := framebuffer/res/throbber/throbber8.png

# Host tool to convert image bitmaps to source code.
#
# convert_image dependd on fb_bitmap.h so that if we change that
# header, we get new images built.
$(TOOLROOT)/convert_image: $(TOOLROOT)/created framebuffer/convert_image.c framebuffer/fbtk.h
	$(VQ)echo " HOST CC: $@"
	$(Q)$(HOST_CC) -o $@ framebuffer/convert_image.c -lpng

# 1: input file
# 2: output file
# 3: bitmap name
define convert_image

S_IMAGES += $(2)

$(2): $(1) $(TOOLROOT)/convert_image
	$(Q)$(TOOLROOT)/convert_image $(1) $(2) $(3)

endef

S_IMAGES :=

$(eval $(foreach V,$(filter FB_IMAGE_%,$(.VARIABLES)),$(call convert_image,$($(V)),$(OBJROOT)/image-$(patsubst FB_IMAGE_%,%,$(V)).c,$(patsubst FB_IMAGE_%,%,$(V)))))


# Internal fonts to generate
FB_FONT_internal_ns-sans := framebuffer/res/fonts/glyph_data

# Internal font conversion
$(TOOLROOT)/convert_font: $(TOOLROOT)/created framebuffer/convert_font.c
	$(VQ)echo " HOST CC: $@"
	$(Q)$(HOST_CC) -o $@ framebuffer/convert_font.c

# 1: input file
# 2: output source code file
# 3: output header file
# 4: font name
define convert_font

S_FONTS += $(2)

$(2): $(1) $(TOOLROOT)/convert_font
	$(VQ)echo "    FONT: $(1) ($(4))"
	$(Q)$(TOOLROOT)/convert_font -H $(3) $(1) $(2)

endef

S_FONTS :=

$(eval $(foreach V,$(filter FB_FONT_$(NETSURF_FB_FONTLIB)_%,$(.VARIABLES)),$(call convert_font,$($(V)),$(OBJROOT)/font-$(patsubst FB_FONT_$(NETSURF_FB_FONTLIB)_%,%,$(V)).c,$(OBJROOT)/font-$(patsubst FB_FONT_$(NETSURF_FB_FONTLIB)_%,%,$(V)).h,$(patsubst FB_FONT_$(NETSURF_FB_FONTLIB)_%,%,$(V)))))

# ----------------------------------------------------------------------------
# Source file setup
# ----------------------------------------------------------------------------

# S_FRAMEBUFFER are sources purely for the framebuffer build
S_FRAMEBUFFER := gui.c framebuffer.c schedule.c				\
	thumbnail.c misc.c bitmap.c fetch.c findfile.c	\
	localhistory.c clipboard.c

S_FRAMEBUFFER_FBTK := fbtk.c event.c fill.c bitmap.c user.c window.c 	\
	text.c scroll.c osk.c 

S_FRAMEBUFFER += font_$(NETSURF_FB_FONTLIB).c

S_FRAMEBUFFER := $(addprefix framebuffer/,$(S_FRAMEBUFFER)) $(addprefix framebuffer/fbtk/,$(S_FRAMEBUFFER_FBTK))

# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
#   are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRAMEBUFFER) $(S_IMAGES) $(S_FONTS)
EXETARGET := nsfb

# ----------------------------------------------------------------------------
# Install target
# ----------------------------------------------------------------------------

NETSURF_FRAMEBUFFER_RESOURCE_LIST := adblock.css credits.html	\
	default.css internal.css licence.html			\
	netsurf.png quirks.css welcome.html maps.html Messages

install-framebuffer:
	$(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
	$(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
	$(Q)cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf$(SUBTARGET)
	$(Q)for F in $(NETSURF_FRAMEBUFFER_RESOURCE_LIST); do cp -vL framebuffer/res/$$F $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done
	$(Q)$(SPLIT_MESSAGES) -l en -p fb -f messages resources/FatMessages | gzip -9n > $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages

# ----------------------------------------------------------------------------
# Package target
# ----------------------------------------------------------------------------

package-framebuffer: