Skip to content

Commit

Permalink
Merge pull request #25 from harlequin/develop
Browse files Browse the repository at this point in the history
Complete carry over from develop branch
  • Loading branch information
harlequin authored Jul 19, 2016
2 parents 8fdc538 + 34a6fbc commit fdcb6e7
Show file tree
Hide file tree
Showing 23 changed files with 3,589 additions and 731 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/.cproject
/*.so
/.build

*.o
6 changes: 3 additions & 3 deletions C_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ unsigned int* find_func_by_string(void *h, char *fName, char *f_string, int seek
{
//read_mem(pid, &tmp, 1, cur_addr);
tmp=*(unsigned long*)cur_addr;
if(ldr_addr=(void*)check_is_LDR_RD((unsigned long)cur_addr,tmp) )
if( (ldr_addr=(void*)check_is_LDR_RD((unsigned long)cur_addr,tmp)) )
{
// read_mem(pid, &p_addr, 1, ldr_addr);
p_addr=(void*)*ldr_addr;
Expand Down Expand Up @@ -157,13 +157,13 @@ unsigned int* find_func_by_string(void *h, char *fName, char *f_string, int seek
}
#include "C_find.h"
#include <stdio.h>
#include "tv_info.h"
#include "models.h"

void *C_find(void *h, const char *fn_name)
{
static int model=TV_MODEL_UNK;
if(model == TV_MODEL_UNK)
model=getTVModel();
model= model_type();
if(model!=TV_MODEL_C)
return 0;
else
Expand Down
90 changes: 73 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,82 @@
TARGETS=libdvbapi.so

CFLAGS += -fPIC -O2 -std=gnu99 -I../include -mglibc -march=34kc
APP_OBJ = dvbapi.o hook.o C_support.o log.o models.o
LIB_TV_MODEL=
CFLAGS += -fPIC -O2 -std=gnu99 -Wall
CFLAGS += -ldl -DBUILD_GIT_SHA=\"$(GIT_VERSION)\"
GIT_VERSION := $(shell git describe --dirty --always --abbrev=4)
GIT_VERSION := $(shell git describe --dirty --always --abbrev=7)
TAG := $(shell git describe --tags)

# DEFAULT VERSION INFORMATION
CFLAGS += -DLIB_NAME=\""dvbapi"\" -DLIB_VERSION=\""v0.1"\" -DLIB_TV_MODELS=\""D T-MST"\"

all: ${TARGETS}

libdvbapi.so: dvbapi.c hook.c C_support.c log.c $(wildcard *.h) $(wildcard ../include/*.h)
$(CROSS)gcc $(filter %.c %.cpp,$^) ${CFLAGS} -mel -shared -Wl,-soname,$@ -o $@
ifeq ($(PLATFORM), D-MST)
LIB_TV_MODEL=${PLATFORM}
APP_OBJ += models/serie_d_mst.o
CFLAGS += -mglibc -march=34kc -mel -DSPECIAL_HOOK
endif

clean:
rm -f ${TARGETS}
ifeq ($(PLATFORM), H-MST)
LIB_TV_MODEL=${PLATFORM}
APP_OBJ += models/serie_h_mst.o
CFLAGS +=
endif

ifeq ($(PLATFORM), E)
LIB_TV_MODEL=${PLATFORM}
APP_OBJ += models/serie_e.o
CFLAGS +=
endif

ifeq ($(PLATFORM), E-MST)
LIB_TV_MODEL=${PLATFORM}
APP_OBJ += models/serie_e_mst.o
CFLAGS +=
endif

ifeq ($(PLATFORM), D)
LIB_TV_MODEL=${PLATFORM}
APP_OBJ += models/serie_d.o
CFLAGS +=
endif

ifeq ($(PLATFORM), F)
LIB_TV_MODEL=${PLATFORM}
APP_OBJ += models/serie_f.o
CFLAGS +=
endif

ifeq ($(PLATFORM), F-MST)
LIB_TV_MODEL=${PLATFORM}
APP_OBJ += models/serie_f.o
CFLAGS +=
endif

ifeq (${TARGET_IP}, )

ifeq ($(PLATFORM), H-TNT)
LIB_TV_MODEL=${PLATFORM}
APP_OBJ += models/serie_h_TNT.o
CFLAGS +=
endif

install: ${TARGETS}
ping -c1 -W1 -w1 ${TARGET_IP} >/dev/null && \
lftp -v -c "open ${TARGET_IP};cd ${TARGET_DEST_DIR};mput $^;"
OBJS = $(APP_OBJ)
LIB:=libdvbapi-${PLATFORM}-${TAG}.so

# DEFAULT VERSION INFORMATION
CFLAGS += -DLIB_NAME=\""dvbapi"\" -DLIB_VERSION=\""${TAG}"\" -DLIB_TV_MODELS=\""${LIB_TV_MODEL}"\"

all: libdvbapi.so
ifeq ($(LIB_TV_MODEL), )
$(error No platform selected!)
endif

libdvbapi.so: $(OBJS)
$(CROSS)gcc $(CFLAGS) $(OBJS) $(LDFLAGS) -shared -Wl,-soname,$(LIB) -o $(LIB)


#$(CROSS)gcc $(CFLAGS) $(OBJS) -shared -Wl,-soname,$@ -o $@

.c.o:
$(CROSS)gcc $(CFLAGS) -c -o $@ $<

clean:
rm -f $(OBJS) ${TARGETS} ./models/*.o *.so

.PHONY: clean
.PHONY: install
.PHONY: install
49 changes: 33 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,40 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

BUILD_DIR=".build"
GIT_URL="https://github.com/harlequin/samygo-plugin-dvbapi.git"

function clone2build {
echo "Building "$1" TARGET"
mkdir -p $BUILD_DIR"/"$1
(cd $BUILD_DIR"/"$1;\
git clone -b $3 --depth 1 $GIT_URL .;\
CROSS=$2 make;\
mv#.so "../samygo-plugin-dvbapi-"$3".so";\
tar -zcvf "../samygo-plugin-dvbapi-"$3".tar.gz" "../samygo-plugin-dvbapi-"$3".so";\
rm -rf "../samygo-plugin-dvbapi-"$3".so")
}

VERSION=`git describe --tags`
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR
make clean

export CROSS=mips-linux-gnu-
make PLATFORM=D-MST
mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=H-MST
mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=D
mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=E
mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=F
mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=F-MST
mv *.so $BUILD_DIR
make clean

clone2build samygo-plugin-dvbapi_D-MST mips-linux-gnu- D-MST-v0.1
clone2build samygo-plugin-dvbapi_H-T-MST arm-none-linux-gnueabi- H-MST-v0.1
(cd $BUILD_DIR; tar -czf samygo-plugin-dvbapi-$VERSION.tar.gz *; mv *.tar.gz ./..;)
Loading

0 comments on commit fdcb6e7

Please sign in to comment.