Add option to build as shared library, add option to install the library for system wide use
This commit is contained in:
parent
76c9eaa576
commit
08355a6682
|
@ -10,12 +10,18 @@
|
|||
LDEMULATION := elf_i386
|
||||
endif
|
||||
USE_LDD = 1
|
||||
else ifneq ($(shell gold --version 2>&1 | head -n 1 | grep gold),)
|
||||
LD = gold
|
||||
endif
|
||||
|
||||
|
||||
# set name
|
||||
NAME = Xputty
|
||||
VER = 0.1
|
||||
VER = 1.0
|
||||
|
||||
PREFIX ?= /usr
|
||||
INSTALL_DIR ?= $(PREFIX)/lib/
|
||||
INCLUDE_DIR ?= $(PREFIX)/include/
|
||||
SHARE_DIR ?= $(PREFIX)/share/
|
||||
|
||||
LIB_DIR := ../xputty/
|
||||
HEADER_DIR := $(LIB_DIR)header/
|
||||
|
@ -62,7 +68,7 @@
|
|||
|
||||
DEP = $(LIB_OBJ:%.o=%.d) $(WIDGET_OBJ:%.o=%.d) $(DIALOG_OBJ:%.o=%.d) $(XDG_OBJ:%.o=%.d)
|
||||
|
||||
.PHONY : all clean debug nls updatepot po
|
||||
.PHONY : all clean debug nls updatepot po shared
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
|
@ -79,7 +85,7 @@ updatepot:
|
|||
po:
|
||||
|
||||
clean:
|
||||
rm -f libxputty.a $(LIB_OBJ) $(WIDGET_OBJ) $(RESOURCES_OBJ) $(DIALOG_OBJ) $(XDG_OBJ) $(DEP) $(RESOURCEHEADER)
|
||||
rm -f libxputty.a libxputty.so libxputty.so.1 libxputty.so.1.0 xputty.pc $(LIB_OBJ) $(WIDGET_OBJ) $(RESOURCES_OBJ) $(DIALOG_OBJ) $(XDG_OBJ) $(DEP) $(RESOURCEHEADER)
|
||||
rm -rf $(RELEASE_DIR)
|
||||
|
||||
$(RESOURCEHEADER): $(RESOURCES_OBJ)
|
||||
|
@ -110,9 +116,11 @@ $(LIB_OBJ): $(LIB_SOURCES)
|
|||
|
||||
-include $(DEP)
|
||||
|
||||
libxputty.a: $(RESOURCES_OBJ) $(LIB_OBJ) $(WIDGET_OBJ) $(DIALOG_OBJ) $(XDG_OBJ)
|
||||
xputty.pc: xputty.pc.in
|
||||
sed 's;PATH;$(PREFIX);' $< >$@
|
||||
|
||||
libxputty.a: $(RESOURCES_OBJ) $(LIB_OBJ) $(WIDGET_OBJ) $(DIALOG_OBJ) $(XDG_OBJ)
|
||||
$(AR) rcs libxputty.a $(LIB_OBJ) $(WIDGET_OBJ) $(DIALOG_OBJ) $(RESOURCES_OBJ) $(XDG_OBJ)
|
||||
#$(CC) -shared $(LIB_OBJ) $(WIDGET_OBJ) $(DIALOG_OBJ) $(RESOURCES_OBJ) $(XDG_OBJ) -o libxputty.so
|
||||
mkdir -p $(RELEASE_DIR)include/
|
||||
cp $(HEADER_DIR)*.h $(RELEASE_DIR)include/
|
||||
cp $(WIDGET_HEADER_DIR)*.h $(RELEASE_DIR)include/
|
||||
|
@ -122,11 +130,36 @@ libxputty.a: $(RESOURCES_OBJ) $(LIB_OBJ) $(WIDGET_OBJ) $(DIALOG_OBJ) $(XDG_OBJ)
|
|||
cp -r $(LIB_DIR)lv2_plugin $(RELEASE_DIR)
|
||||
cp libxputty.a $(RELEASE_DIR)
|
||||
|
||||
shared: xputty.pc $(RESOURCEHEADER) libxputty.a
|
||||
$(CC) -shared -Wl,-soname,libxputty.so.1 -o libxputty.so.1.0 $(LIB_OBJ) $(WIDGET_OBJ) $(DIALOG_OBJ) $(RESOURCES_OBJ) $(XDG_OBJ)
|
||||
cp libxputty.so.1.0 $(RELEASE_DIR)
|
||||
ln -sf libxputty.so.1.0 libxputty.so.1
|
||||
ln -sf libxputty.so.1 libxputty.so
|
||||
cp -df libxputty.so.1 $(RELEASE_DIR)
|
||||
cp -df libxputty.so $(RELEASE_DIR)
|
||||
cp xputty.pc $(RELEASE_DIR)
|
||||
|
||||
doc:
|
||||
|
||||
mod:
|
||||
|
||||
install:
|
||||
install: shared
|
||||
ifneq ("$(wildcard $(RELEASE_DIR))","")
|
||||
mkdir -p $(DESTDIR)$(INCLUDE_DIR)xputty/
|
||||
mkdir -p $(DESTDIR)$(INSTALL_DIR)
|
||||
mkdir -p $(DESTDIR)$(SHARE_DIR)pkgconfig/
|
||||
cp $(RELEASE_DIR)include/*.h $(DESTDIR)$(INCLUDE_DIR)xputty/
|
||||
cp $(RELEASE_DIR)*.so.1.0 $(DESTDIR)$(INSTALL_DIR)
|
||||
cp -df $(RELEASE_DIR)*.so.1 $(DESTDIR)$(INSTALL_DIR)
|
||||
cp -df $(RELEASE_DIR)*.so $(DESTDIR)$(INSTALL_DIR)
|
||||
cp $(RELEASE_DIR)libxputty.a $(DESTDIR)$(INSTALL_DIR)
|
||||
cp $(RELEASE_DIR)xputty.pc $(DESTDIR)$(SHARE_DIR)pkgconfig/
|
||||
else
|
||||
@echo "you must run 'make' first"
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
|
||||
@rm -rf $(DESTDIR)$(INSTALL_DIR)libxputty.so $(DESTDIR)$(INSTALL_DIR)libxputty.so.1 \
|
||||
$(DESTDIR)$(INSTALL_DIR)libxputty.so.1.0 $(DESTDIR)$(INSTALL_DIR)libxputty.a
|
||||
@rm -rf $(DESTDIR)$(INCLUDE_DIR)xputty/
|
||||
@rm -rf $(DESTDIR)$(SHARE_DIR)pkgconfig/xputty.pc
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
prefix=PATH
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
Name: xputty
|
||||
Description: A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
|
||||
Version: 1.0
|
||||
Requires.private: cairo x11
|
||||
Libs: -L${libdir} -lxputty
|
||||
Cflags: -I${includedir}/xputty
|
6
Makefile
6
Makefile
|
@ -4,6 +4,12 @@ SUBDIR := $(filter-out xputty/, $(SUBDIR))
|
|||
SUBDIR := $(filter-out docs/, $(SUBDIR))
|
||||
SUBDIR := $(filter-out libxputty/, $(SUBDIR))
|
||||
|
||||
GOALS := install uninstall
|
||||
|
||||
ifneq ($(filter $(GOALS),$(MAKECMDGOALS)),)
|
||||
SUBDIR := $(filter-out Build/, $(SUBDIR))
|
||||
endif
|
||||
|
||||
.PHONY: $(SUBDIR) recurse
|
||||
|
||||
$(MAKECMDGOALS) recurse: $(SUBDIR)
|
||||
|
|
|
@ -29,11 +29,33 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief tabbox_add_tab - add a tab to a tabbox Widget_t
|
||||
* @param *tabbox - pointer to the tabbox Widget_t the tab should added to
|
||||
* @param *label - the label of the tab
|
||||
* @return Widget_t* - pointer to the Widget_t tab struct
|
||||
*/
|
||||
|
||||
Widget_t* tabbox_add_tab(Widget_t *tabbox, const char * label);
|
||||
|
||||
/**
|
||||
* @brief add_tabbox - add a tabbox to a Widget_t
|
||||
* @param *parent - pointer to the Widget_t request the tabbox
|
||||
* @param *label - the label of the tabbox
|
||||
* @param x,y,width,height - the position/geometry to create the tabbox
|
||||
* @return Widget_t* - pointer to the Widget_t tabbox struct
|
||||
*/
|
||||
|
||||
Widget_t* add_tabbox(Widget_t *parent, const char * label,
|
||||
int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* @brief tabbox_remove_tab - remove a tab from a tabbox Widget_t
|
||||
* @param *tabbox - pointer to the tabbox Widget_t the tab should removed from
|
||||
* @param tab - the number of the tab
|
||||
* @return void
|
||||
*/
|
||||
|
||||
void tabbox_remove_tab(Widget_t *tabbox, int tab);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -29,10 +29,31 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief _draw_tabbox - draw the tabbox on expose call
|
||||
* @param *w_ - the tabbox to draw
|
||||
* @param *user_data - attached user_data
|
||||
* @return void
|
||||
*/
|
||||
|
||||
void _draw_tabbox(void *w_, void* user_data);
|
||||
|
||||
/**
|
||||
* @brief _draw_tab - draw a single tab on expose call
|
||||
* @param *w_ - the tab to draw
|
||||
* @param *user_data - attached user_data
|
||||
* @return void
|
||||
*/
|
||||
|
||||
void _draw_tab(void *w_, void* user_data);
|
||||
|
||||
/**
|
||||
* @brief _tab_button_released - select the tab to show (hide all other)
|
||||
* @param *button - the xbutton which is pressed
|
||||
* @param *user_data - attached user_data
|
||||
* @return void
|
||||
*/
|
||||
|
||||
void _tab_button_released(void *w_, void* button_, void* user_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -51,12 +51,12 @@ void _draw_waveview(void *w_, void* user_data) {
|
|||
|
||||
cairo_set_line_width(w->crb,2);
|
||||
use_bg_color_scheme(w, NORMAL_);
|
||||
_rounded_view(w->crb, 5, 5, width_t-10, height_t-10, extents.width+10);
|
||||
_rounded_view(w->crb, 2, 5, width_t-4, height_t-7, extents.width+15);
|
||||
cairo_fill_preserve(w->crb);
|
||||
use_frame_color_scheme(w, NORMAL_);
|
||||
cairo_stroke(w->crb);
|
||||
cairo_move_to(w->crb,5,half_height_t);
|
||||
cairo_line_to(w->crb, width_t-5, half_height_t);
|
||||
cairo_move_to(w->crb,2,half_height_t);
|
||||
cairo_line_to(w->crb, width_t-4, half_height_t);
|
||||
cairo_stroke(w->crb);
|
||||
|
||||
use_text_color_scheme(w, get_color_state(w));
|
||||
|
@ -73,5 +73,22 @@ void _draw_waveview(void *w_, void* user_data) {
|
|||
for (;i<wave_view->size;i++) {
|
||||
cairo_line_to(w->crb, (float)(i+0.5)*step,(float)(half_height_t)+ -wave_view->wave[i]*lstep);
|
||||
}
|
||||
cairo_line_to(w->crb, width_t, half_height_t);
|
||||
cairo_line_to(w->crb, 2, half_height_t);
|
||||
cairo_close_path(w->crb);
|
||||
use_light_color_scheme(w, NORMAL_);
|
||||
cairo_fill_preserve(w->crb);
|
||||
use_fg_color_scheme(w, NORMAL_);
|
||||
cairo_stroke(w->crb);
|
||||
i = 0;
|
||||
for (;i<wave_view->size;i++) {
|
||||
cairo_line_to(w->crb, (float)(i+0.5)*step,(float)(half_height_t)+ wave_view->wave[i]*lstep);
|
||||
}
|
||||
cairo_line_to(w->crb, width_t, half_height_t);
|
||||
cairo_line_to(w->crb, 2, half_height_t);
|
||||
cairo_close_path(w->crb);
|
||||
use_light_color_scheme(w, NORMAL_);
|
||||
cairo_fill_preserve(w->crb);
|
||||
use_fg_color_scheme(w, NORMAL_);
|
||||
cairo_stroke(w->crb);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue