Skip to content

Commit

Permalink
refactoring of the build system to produce multiple binaries:
Browse files Browse the repository at this point in the history
this way single components can drop library dependencies,
which makes it better for embedded installations,
for instance having the synced player without installing X
  • Loading branch information
jaromil committed Aug 29, 2008
1 parent 119f192 commit d874638
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 72 deletions.
52 changes: 4 additions & 48 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,51 +1,7 @@
# We don't need kludgy automatizations here,
# let's use a simple Makefile.
# Just tweak the values below to fix your paths
#
# $Id: Makefile 60 2004-11-12 15:40:18Z jaromil $

all:
# to build run the compile.sh script

CPP = g++
LINKER = ld

GTKFLAGS = `pkg-config --cflags gtk+-2.0`
GTKLIBS = `pkg-config --libs gtk+-2.0`

# debugging flags:
#CPPFLAGS = -I. -Ixmlrpc++ -Wall -g -ggdb $(GTKFLAGS)
# optimized flags:
CPPFLAGS = -I. -Ixmlrpc++ -Wall -O2 -fomit-frame-pointer -ffast-math




LIBS = xmlrpc++/libxmlrpc++.a -lpthread -lssl

IVYSYNC_OBJ = decoder.o thread.o linklist.o utils.o cmdline.o xmlrpc.o

all: xmlrpc ivysync ivysync-nox

xmlrpc:
cd xmlrpc++ && $(MAKE)

ivysync: $(IVYSYNC_OBJ) gui.o
$(CPP) $(CPPFLAGS) -o ivysync $(IVYSYNC_OBJ) $(LIBS) $(GTKLIBS)

ivysync-nox: $(IVYSYNC_OBJ)
$(CPP) $(CPPFLAGS) -o ivysync-nox $(IVYSYNC_OBJ) $(LIBS)


#make clean
clean:
rm -rf *.o *~ ivysync

install: ivysync
install ivysync /usr/local/bin

# generic make rules
#%: %.c
# $(CC) $(CFLAGS) -o $@ $< $(LIBS)
#%.o: %.c
# $(CC) $(CFLAGS) -c -o $@ $<


rm -f *.a *.o *~
rm -f ivysync-nox ivysync-rpc ivysync-gtk xmlrpc++/*.o xmlrpc++/*.a
35 changes: 35 additions & 0 deletions Makefile.player
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# We don't need kludgy automatizations here,
# let's use a simple Makefile.
# Just tweak the values below to fix your paths
#
# $Id: Makefile 60 2004-11-12 15:40:18Z jaromil $


CPP = g++
LINKER = ld

CPPFLAGS = -I. -Wall -O2 -fomit-frame-pointer -ffast-math


IVYSYNC_OBJ = decoder.o thread.o linklist.o utils.o cmdline.o

all: ivysync-nox

ivysync-nox: $(IVYSYNC_OBJ)
$(CPP) $(CPPFLAGS) -o ivysync-nox $(IVYSYNC_OBJ) -lpthread
rm -f *.o

#make clean
clean:
rm -rf *.o *~ ivysync-nox

install: ivysync-nox
install ivysync-nox /usr/local/bin

# generic make rules
#%: %.c
# $(CC) $(CFLAGS) -o $@ $< $(LIBS)
#%.o: %.c
# $(CC) $(CFLAGS) -c -o $@ $<


39 changes: 39 additions & 0 deletions Makefile.playlist
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# We don't need kludgy automatizations here,
# let's use a simple Makefile.
# Just tweak the values below to fix your paths
#
# $Id: Makefile 60 2004-11-12 15:40:18Z jaromil $


CPP = g++
LINKER = ld

GTKFLAGS = -DWITH_GUI `pkg-config --cflags gtk+-2.0`
GTKLIBS = `pkg-config --libs gtk+-2.0`

# debugging flags:
#CPPFLAGS = -I. -Ixmlrpc++ -Wall -g -ggdb $(GTKFLAGS)
# optimized flags:
CPPFLAGS = -I. -Wall -O2 -fomit-frame-pointer -ffast-math $(GTKFLAGS)




IVYSYNC_OBJ = decoder.o thread.o linklist.o utils.o cmdline.o gui.o

all: ivysync-gtk

ivysync-gtk: $(IVYSYNC_OBJ)
$(CPP) $(CPPFLAGS) -o ivysync-gtk $(IVYSYNC_OBJ) $(GTKLIBS) -lpthread
rm -f *.o

install: ivysync-gtk
install ivysync-gtk /usr/local/bin

# generic make rules
#%: %.c
# $(CC) $(CFLAGS) -o $@ $< $(LIBS)
#%.o: %.c
# $(CC) $(CFLAGS) -c -o $@ $<


43 changes: 43 additions & 0 deletions Makefile.xmlrpc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# We don't need kludgy automatizations here,
# let's use a simple Makefile.
# Just tweak the values below to fix your paths
#
# $Id: Makefile 60 2004-11-12 15:40:18Z jaromil $


CPP = g++
LINKER = ld


# debugging flags:
#CPPFLAGS = -I. -Ixmlrpc++ -Wall -g -ggdb $(GTKFLAGS)
# optimized flags:

CPPFLAGS = -I. -Ixmlrpc++ -Wall -O2 -fomit-frame-pointer -ffast-math -DWITH_XMLRPC




LIBS = xmlrpc++/libxmlrpc++.a -lpthread -lssl

IVYSYNC_OBJ = decoder.o thread.o linklist.o utils.o cmdline.o xmlrpc.o

all: xmlrpc ivysync-rpc

xmlrpc:
cd xmlrpc++ && $(MAKE)

ivysync-rpc: $(IVYSYNC_OBJ)
$(CPP) $(CPPFLAGS) -o ivysync-rpc $(IVYSYNC_OBJ) $(LIBS)
rm -f *.o

install: ivysync-rpc
install ivysync-rpc /usr/local/bin

# generic make rules
#%: %.c
# $(CC) $(CFLAGS) -o $@ $< $(LIBS)
#%.o: %.c
# $(CC) $(CFLAGS) -c -o $@ $<


52 changes: 31 additions & 21 deletions cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@
#include <getopt.h>
#include <errno.h>
#include <signal.h>
#include <string.h>

#include <decoder.h>

#ifdef WITH_XMLRPC
#include <xmlrpc.h>
#endif

#ifdef WITH_GUI
#include <gui.h>
Expand All @@ -59,11 +62,12 @@ Linklist decoders;
Gui *gui;
#endif

#ifdef WITH_XMLRPC
// xmlrpc interface
XmlRpcServer *xmlrpc;

// Threaded daemon
IvySyncDaemon *ivydaemon;
#endif

const char *help =
"Usage: ivysync [-hsDgt] [ -d /dev/video16 [ -p playmode files ] ]\n"
Expand All @@ -86,7 +90,9 @@ const struct option long_options[] = {
{ "device", required_argument, NULL, 'd'},
{ "scan", no_argument, NULL, 's'},
{ "buffer", required_argument, NULL, 'b'},
#ifdef WITH_XMLRPC
{ "xmlrpc", required_argument, NULL, 'x'},
#endif
{ "playmode", required_argument, NULL, 'p'},
#ifdef WITH_GUI
{ "gui", no_argument, NULL, 'g'},
Expand Down Expand Up @@ -322,6 +328,7 @@ int main(int argc, char **argv) {

#endif

#ifdef WITH_XMLRPC
////////////////////////////////
/// setup the XMLRPC interface
if(rpcdaemon) {
Expand Down Expand Up @@ -351,9 +358,8 @@ int main(int argc, char **argv) {
A("XMLRPC daemon listening for commands on port %u",
rpcdaemonport);
}

////////////////////////////////

#endif


////////////////////////////////
Expand Down Expand Up @@ -389,6 +395,7 @@ int main(int argc, char **argv) {



#ifdef WITH_XMLRPC
if(rpcdaemon) {

// run as a daemon: quit only when requested
Expand All @@ -397,24 +404,27 @@ int main(int argc, char **argv) {
jsleep(0,10);
}

} else {

// run until all the channels are at the end
int still_running = decoders.len();

while(still_running) {

still_running = 0;
dec = (Decoder*)decoders.begin();

while(dec) {

if(dec->playing) still_running++;

jsleep(1,0); // 1 second delay check

dec = (Decoder*)dec->next;
}
N("quit!");
exit(1);
}
#endif


// run until all the channels are at the end
int still_running = decoders.len();

while(still_running) {

still_running = 0;
dec = (Decoder*)decoders.begin();

while(dec) {

if(dec->playing) still_running++;

jsleep(1,0); // 1 second delay check

dec = (Decoder*)dec->next;
}
}

Expand Down
46 changes: 46 additions & 0 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

echo
echo

echo "IvySync consists of different applications to manipulate and play"
echo "syncstarted videos on multiple channels. First make sure all your"
echo "dependencies are in place (-devel packages on your distribution)"
echo "then choose below what to compile:"

echo

echo "1 - Standalone player - playback configured playlists"
echo "2 - Playlist editor - graphical interface for playlists"
echo "3 - XMLRPC daemon - remote controlled player daemon"
echo "4 - ALL of the above"

echo

echo "press a number and then [enter]"
read -s sel


case $sel in
1)
make -f Makefile.player
;;
2)
make -f Makefile.playlist
;;
3)
make -f Makefile.xmlrpc
;;
4)
make -f Makefile.player
make -f Makefile.playlist
make -f Makefile.xmlrpc
;;
*)
echo "invalid selection."
;;
esac




8 changes: 5 additions & 3 deletions gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include <iostream>
#include <cstdio>

#include <stdlib.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
Expand Down Expand Up @@ -420,15 +422,15 @@ Playlist::Playlist(int num) {


{ // then the drag and drop stuff
target_entry[0].target = DRAG_TAR_NAME_0;
target_entry[0].target = (gchar*)DRAG_TAR_NAME_0;
target_entry[0].flags = 0;
target_entry[0].info = DRAG_TAR_INFO_0;

target_entry[1].target = DRAG_TAR_NAME_1;
target_entry[1].target = (gchar*)DRAG_TAR_NAME_1;
target_entry[1].flags = 0;
target_entry[1].info = DRAG_TAR_INFO_1;

target_entry[2].target = DRAG_TAR_NAME_2;
target_entry[2].target = (gchar*)DRAG_TAR_NAME_2;
target_entry[2].flags = 0;
target_entry[2].info = DRAG_TAR_INFO_2;

Expand Down
4 changes: 4 additions & 0 deletions xmlrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*/


#ifdef WITH_XMLRPC

#include <decoder.h>
#include <xmlrpc.h>
#include <utils.h>
Expand Down Expand Up @@ -307,3 +309,5 @@ void SetOffset::execute(XmlRpcValue &params, XmlRpcValue &result) {
D("XMLRPC: SetOffset decoder %u to position %d", decnum, pos);
dec->setoffset( (off64_t) pos );
}

#endif
3 changes: 3 additions & 0 deletions xmlrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#ifndef __XMLRPC_H__
#define __XMLRPC_H__

#ifdef WITH_XMLRPC

#include <XmlRpc.h>

Expand Down Expand Up @@ -207,3 +208,5 @@ class Quit : public XmlRpcServerMethod, IvySyncPublicMethod {
};

#endif

#endif

0 comments on commit d874638

Please sign in to comment.