From a708b77a2d67f916b2c39886ac175960338e4f48 Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 18 May 2014 03:15:38 +0200 Subject: [PATCH] Add Cydia packaging --- libr/asm/p/asm_ppc_cs.c | 2 +- libr/util/str.c | 6 +- sys/cydia/deb_hand.mak | 127 +++++++++++++++++++++++++++++++++++++ sys/cydia/radare2/CONFIG | 6 ++ sys/cydia/radare2/DESCR | 2 + sys/cydia/radare2/Makefile | 13 ++++ sys/ios-sdk.sh | 6 +- 7 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 sys/cydia/deb_hand.mak create mode 100644 sys/cydia/radare2/CONFIG create mode 100644 sys/cydia/radare2/DESCR create mode 100644 sys/cydia/radare2/Makefile diff --git a/libr/asm/p/asm_ppc_cs.c b/libr/asm/p/asm_ppc_cs.c index 50e161d2d5..1b6979fc79 100644 --- a/libr/asm/p/asm_ppc_cs.c +++ b/libr/asm/p/asm_ppc_cs.c @@ -50,7 +50,7 @@ RAsmPlugin r_asm_plugin_ppc_cs = { .desc = "Capstone PowerPC disassembler", .license = "BSD", .arch = "ppc", - .bits = 32, + .bits = 32|64, .init = NULL, .fini = the_end, .disassemble = &disassemble, diff --git a/libr/util/str.c b/libr/util/str.c index df1f0efe0b..5a7d3afe30 100644 --- a/libr/util/str.c +++ b/libr/util/str.c @@ -1312,6 +1312,10 @@ R_API int r_str_bounds(const char *str, int *h) { return W; } +R_API char *r_str_crop(const char *str, int x, int y, int w, int h) { + char *ret = strdup (str); +} + R_API const char * r_str_tok (const char *str1, const char b, size_t len) { const char *p = str1; size_t i = 0; @@ -1320,4 +1324,4 @@ R_API const char * r_str_tok (const char *str1, const char b, size_t len) { for ( ; i < len; i++,p++) if (*p == b) break; if (i == len) p = NULL; return p; -} \ No newline at end of file +} diff --git a/sys/cydia/deb_hand.mak b/sys/cydia/deb_hand.mak new file mode 100644 index 0000000000..6472634db4 --- /dev/null +++ b/sys/cydia/deb_hand.mak @@ -0,0 +1,127 @@ +# Create .deb without using dpkg tools. +# +# Author: Tim Wegener +# +# Use 'include deb_hand.mak' after defining the user variables in a local +# makefile. +# +# The 'data' rule must be customised in the local make file. +# This rule should make a 'data' directory containing the full file +# layout of the installed package. +# +# This makefile will create a debian-binary file a control directory and a +# a build directory in the current directory. +# Do 'make clobber' to remove these generated files. +# +# Destination: +# PACKAGE_DIR - directory where package (and support files) will be built +# defaults to the current directory +# +# Sources: +# SOURCE_DIR - directory containing files to be packaged +# ICON_SOURCE - 26x26 icon file for maemo +# DESCR - description with summary on first line +# preinst, postinst, prerm, postrm - optional control shell scripts + +# These fields are used to build the control file: +# PACKAGE = +# VERSION = +# ARCH = +# SECTION = +# PRIORITY = +# MAINTAINER = +# DEPENDS = +# +# SOURCE_DIR = +# ICON_SOURCE = +# (ICON_SOURCE is optional) + +# *** NO USER CHANGES REQUIRED BEYOND THIS POINT *** +ifeq ($(shell uname),Darwin) +MD5SUM=md5 +else +MD5SUM=md5sum +endif + +GAWK=awk +PACKAGE_DIR?=$(shell pwd) +CONTROL_EXTRAS ?= ${wildcard preinst postinst prerm postrm} + +${PACKAGE_DIR}/control: ${PACKAGE_DIR}/data ${CONTROL_EXTRAS} DESCR \ + ${ICON_SOURCE} + #rm -rf $@ + mkdir -p $@ +ifneq (${CONTROL_EXTRAS},) + cp ${CONTROL_EXTRAS} $@ +endif +# Make control file. + echo "Package: ${PACKAGE}" > $@/control + echo "Version: ${VERSION}" >> $@/control + echo "Section: ${SECTION}" >> $@/control + echo "Priority: ${PRIORITY}" >> $@/control + echo "Architecture: ${ARCH}" >> $@/control +ifneq (${DEPENDS},) + echo "Depends: ${DEPENDS}" >> $@/control +endif + echo "Installed-Size: ${shell du -s ${PACKAGE_DIR}/data|cut -f1}" \ + >> $@/control + echo "Maintainer: ${MAINTAINER}" >> $@/control + printf "Description:" >> $@/control + cat DESCR | ${GAWK} '{print " "$$0;}' >> $@/control +#ifneq (${ICON_SOURCE},) +# echo "Maemo-Icon-26:" >> $@/control +# base64 ${ICON_SOURCE} | ${GAWK} '{print " "$$0;}' >> $@/control +#endif +# Make md5sums. + cd ${PACKAGE_DIR}/data && find . -type f -exec ${MD5SUM} {} \; \ + | sed -e 's| \./||' \ + > $@/md5sums + +${PACKAGE_DIR}/debian-binary: + echo "2.0" > $@ + +${PACKAGE_DIR}/clean: + rm -rf ${PACKAGE_DIR}/data ${PACKAGE_DIR}/control ${PACKAGE_DIR}/build *.deb + +${PACKAGE_DIR}/build: ${PACKAGE_DIR}/debian-binary ${PACKAGE_DIR}/control \ + ${PACKAGE_DIR}/data + rm -rf $@ + mkdir $@ + cp ${PACKAGE_DIR}/debian-binary $@/ + cd ${PACKAGE_DIR}/control && tar czvf $@/control.tar.gz * + cd ${PACKAGE_DIR}/data && \ + COPY_EXTENDED_ATTRIBUTES_DISABLE=true \ + COPYFILE_DISABLE=true \ + tar cpzvf $@/data.tar.gz ./* + +# Convert GNU ar to BSD ar that debian requires. +# Note: Order of files within ar archive is important! +${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb: ${PACKAGE_DIR}/build + ar -rc $@ $ $@fail + #rm -f $@tmp + #mv $@fail $@ + +.PHONY: data +data: ${PACKAGE_DIR}/data + +.PHONY: control +control: ${PACKAGE_DIR}/control + +.PHONY: build +build: ${PACKAGE_DIR}/build + +.PHONY: clean +clean: ${PACKAGE_DIR}/clean + rm -f debian-binary + +.PHONY: deb +deb: ${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb + + +clobber:: + rm -rf ${PACKAGE_DIR}/debian_binary ${PACKAGE_DIR}/control \ + ${PACKAGE_DIR}/data ${PACKAGE_DIR}/build + +push: + scp *.deb radare.org:/srv/http/radareorg/cydia/debs diff --git a/sys/cydia/radare2/CONFIG b/sys/cydia/radare2/CONFIG new file mode 100644 index 0000000000..c224cae60c --- /dev/null +++ b/sys/cydia/radare2/CONFIG @@ -0,0 +1,6 @@ +PACKAGE=radare2 +VERSION=0.9.8.git4 +ARCH=iphoneos-arm +SECTION=user/shell +PRIORITY=optional +MAINTAINER=pancake diff --git a/sys/cydia/radare2/DESCR b/sys/cydia/radare2/DESCR new file mode 100644 index 0000000000..6384155dac --- /dev/null +++ b/sys/cydia/radare2/DESCR @@ -0,0 +1,2 @@ +unix like reverse engineering toolkit +Opensource tools to disasm, debug, analyze, manipulate binary files and more... diff --git a/sys/cydia/radare2/Makefile b/sys/cydia/radare2/Makefile new file mode 100644 index 0000000000..1b239ad91b --- /dev/null +++ b/sys/cydia/radare2/Makefile @@ -0,0 +1,13 @@ +PACKAGE_DIR=$(shell pwd) +include ./CONFIG +DEPENDS= + +all: + sudo rm -rf control data + ${MAKE} clean + mkdir -p data + cp -aRf root/* data + ${MAKE} control + ${MAKE} deb + +include ../deb_hand.mak diff --git a/sys/ios-sdk.sh b/sys/ios-sdk.sh index e638a82f1f..2ce80ce8db 100755 --- a/sys/ios-sdk.sh +++ b/sys/ios-sdk.sh @@ -38,6 +38,10 @@ if [ $? = 0 ]; then ( cd binr/radare2 ; make ios_sdk_sign ) rm -rf /tmp/r2ios make install DESTDIR=/tmp/r2ios - cd /tmp/r2ios && tar czvf ../r2ios-${CPU}.tar.gz * + ( cd /tmp/r2ios && tar czvf ../r2ios-${CPU}.tar.gz * ) + rm -rf sys/cydia/radare2/root + mkdir -p sys/cydia/radare2/root + sudo tar xpzvf /tmp/r2ios-${CPU}.tar.gz -C sys/cydia/radare2/root + ( cd sys/cydia/radare2/root ; make clean ; make ) fi fi