]> git.saurik.com Git - cycript.git/blob - rules.old
apr_pstrdup used to return NULL when passed NULL.
[cycript.git] / rules.old
1 PACKAGE_TARNAME := @PACKAGE_TARNAME@
2
3 CY_ATTACH_GROUP := @CY_ATTACH_GROUP@
4
5 ifneq ($(git),)
6 version := $(shell $(git) describe --always --tags --dirty="+" --match="v*" | $(sed) -e 's@-\([^-]*\)-\([^-]*\)$$@+\1.\2@;s@^v@@')
7 else
8 version := @PACKAGE_VERSION@
9 endif
10
11 lib := lib
12 dll := @SO@
13 depends ?=
14
15 ifdef arch
16 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
17
18 ifeq ($(depends)$(dll),dylib)
19 control.tmp: control.in .libs/cycript .libs/$(lib)cycript.dylib
20 $(sed) -e 's/&/'"$$(dpkg-query -S $$(otool -lah .libs/cycript .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)/' $< >$@
21 else
22 ifeq ($(depends)$(dll),so)
23 control.tmp: control.in .libs/cycript .libs/$(lib)cycript.so
24 $(sed) -e 's/&/'"$$(dpkg-query -S $$(ldd cycript $(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)/' $< >$@
25 else
26 control.tmp: control.in
27 $(sed) -e 's/&/$(depends)/;s/,$$//;s/#/$(version)/;s/%/$(arch)/' $< >$@
28 endif
29 endif
30
31 control: control.tmp
32 [[ -e control ]] && diff control control.tmp &>/dev/null || cp -pRf control.tmp control
33
34 $(deb): $(all) control
35 rm -rf package
36 mkdir -p package/DEBIAN
37 cp -pR control package/DEBIAN
38 mkdir -p package/usr/{bin,lib,sbin}
39 cp -pR .libs/$(lib)cycript.0.$(dll) package/usr/lib
40 cp -pR .libs/$(lib)cycript.$(dll) package/usr/lib
41 cp -pR .libs/cycript package/usr/bin
42 dpkg-deb -b package $(deb)
43 endif
44
45 clean::
46 rm -rf control
47
48 libcycript.la: $(code)
49 $(ldid) .libs/$(lib)cycript.$(dll)
50
51 cycript: Console.lo libcycript.la $(inject)
52 $(entitle) .libs/cycript
53
54 package: $(deb)
55
56 install: cycript libcycript.la
57 ifneq ($(CY_ATTACH_GROUP),)
58 chgrp $(CY_ATTACH_GROUP) $(DESTDIR)$(bindir)/cycript
59 chmod g+s $(DESTDIR)$(bindir)/cycript
60 endif