]>
Commit | Line | Data |
---|---|---|
9968a2d6 JF |
1 | srcdir := . |
2 | ||
3 | sed := sed | |
4 | git := git | |
5 | ||
6 | arch := iphoneos-arm | |
7 | ||
8 | #ifneq ($(git),) | |
9 | version := $(shell $(git) describe --always --tags --dirty="+" --match="v*" | $(sed) -e 's@-\([^-]*\)-\([^-]*\)$$@+\1.\2@;s@^v@@;s@%@~@g') | |
10 | #else | |
11 | #version := @PACKAGE_VERSION@ | |
12 | #endif | |
13 | ||
14 | deb := $(shell grep ^Package: $(srcdir)/control.in | cut -d ' ' -f 2-)_$(shell grep ^Version: $(srcdir)/control.in | cut -d ' ' -f 2 | $(sed) -e 's/\#/$(version)/')_$(arch).deb | |
15 | ||
16 | binary := Cycript_/cycript | |
17 | ||
18 | $(deb): $(binary) $(patsubst %,Cycript_/libcycript%dylib,. -any. -sim. -sys.) control | |
19 | rm -rf package | |
20 | mkdir -p package/DEBIAN | |
21 | cp -pR control package/DEBIAN | |
22 | mkdir -p package/usr/{bin,lib} | |
23 | cp -pR $(filter %.dylib,$^) package/usr/lib | |
24 | cp -pR $< package/usr/bin | |
25 | dpkg-deb -b package $(deb) | |
26 | ||
27 | control: control.tmp | |
28 | [[ -e control ]] && diff control control.tmp &>/dev/null || cp -pRf control.tmp control | |
29 | ||
30 | # XXX: this is now all broken | |
31 | depends := apr-lib, readline, libffi (>= 1:3.0.10-5), adv-cmds | |
32 | ifeq ($(depends)$(dll),dylib) | |
33 | control.tmp: control.in $(binary) .libs/$(lib)cycript.dylib | |
34 | $(sed) -e 's/&/'"$$(dpkg-query -S $$(otool -lah $(binary) .libs/*.dylib | grep dylib | grep -v ':$$' | $(sed) -e 's/^ *name //;s/ (offset [0-9]*)$$//' | sort -u) 2>/dev/null | $(sed) -e 's/:.*//; /^cycript$$/ d; s/$$/,/' | sort -u | tr '\n' ' ')"'/;s/, $$//;s/#/$(version)/;s/%/$(arch)/' $< >$@ | |
35 | else | |
36 | ifeq ($(depends)$(dll),so) | |
37 | control.tmp: control.in $(binary) .libs/$(lib)cycript.so | |
38 | $(sed) -e 's/&/'"$$(dpkg-query -S $$(ldd $(binary) $(lib)cycript.so | $(sed) -e '/:$$/ d; s/^[ \t]*\([^ ]* => \)\?\([^ ]*\) .*/\2/' | sort -u) 2>/dev/null | $(sed) -e 's/:.*//; /^cycript$$/ d; s/$$/,/' | sort -u | tr '\n' ' ')"'/;s/, $$//;s/#/$(version)/;s/%/$(arch)/' $< >$@ | |
39 | else | |
40 | control.tmp: control.in | |
41 | $(sed) -e 's/&/$(depends)/;s/,$$//;s/#/$(version)/;s/%/$(arch)/' $< >$@ | |
42 | endif | |
43 | endif | |
44 | ||
45 | clean:: | |
46 | rm -rf control | |
47 | ||
48 | .PHONY: clean |