]>
Commit | Line | Data |
---|---|---|
ea2d184c JF |
1 | ifndef PKG_TARG |
2 | target := | |
3 | else | |
4 | target := $(PKG_TARG)- | |
5 | endif | |
6 | ||
62ca2b82 JF |
7 | package: |
8 | ||
107e3ed0 | 9 | flags := -framework CFNetwork -framework JavaScriptCore -framework WebCore -install_name /usr/lib/libcycript.dylib -I. |
ea2d184c JF |
10 | menes := $(shell cd ~; pwd)/menes |
11 | ||
12 | link := -framework CoreFoundation -framework Foundation -F${PKG_ROOT}/System/Library/PrivateFrameworks -L$(menes)/mobilesubstrate -lsubstrate -lapr-1 -lffi | |
13 | ||
262e358c | 14 | all: cycript libcycript.dylib libcycript.plist |
ea2d184c JF |
15 | |
16 | clean: | |
262e358c | 17 | rm -f libcycript.dylib cycript libcycript.plist Struct.hpp |
ea2d184c | 18 | |
107e3ed0 | 19 | libcycript.plist: Bridge.def makefile |
707bcb93 | 20 | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' Bridge.def | while read -r line; do \ |
88c977fa JF |
21 | if [[ $$line == '' ]]; then \ |
22 | continue; \ | |
23 | fi; \ | |
24 | set $$line; \ | |
25 | if [[ $$1 =~ [#fl] ]]; then \ | |
26 | continue; \ | |
27 | fi; \ | |
28 | echo "$$2 = ($$1, \"$$3\");"; \ | |
29 | done >$@ | |
30 | ||
04450da0 JF |
31 | Struct.hpp: |
32 | $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@ | |
33 | ||
8d9b5eed JF |
34 | libcycript.dylib: Library.mm makefile $(menes)/mobilesubstrate/substrate.h sig/*.[ch]pp Struct.hpp |
35 | $(target)g++ -dynamiclib -mthumb -g0 -O2 -Wall -Werror -o $@ $(filter %.cpp,$^) $(filter %.mm,$^) -lobjc -I$(menes)/mobilesubstrate $(link) $(flags) | |
ea2d184c JF |
36 | ldid -S $@ |
37 | ||
262e358c | 38 | cycript: Application.mm libcycript.dylib |
8d9b5eed | 39 | $(target)g++ -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc libcycript.dylib |
262e358c JF |
40 | ldid -S cycript |
41 | ||
ea2d184c JF |
42 | package: all |
43 | rm -rf package | |
44 | mkdir -p package/DEBIAN | |
88c977fa | 45 | cp -a control package/DEBIAN |
ea2d184c | 46 | mkdir -p package/Library/MobileSubstrate/DynamicLibraries |
ea2d184c JF |
47 | if [[ -e Settings.plist ]]; then \ |
48 | mkdir -p package/Library/PreferenceLoader/Preferences; \ | |
262e358c JF |
49 | cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \ |
50 | cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \ | |
ea2d184c | 51 | fi |
262e358c JF |
52 | if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi |
53 | #cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries | |
62ca2b82 | 54 | mkdir -p package/usr/{bin,lib} |
262e358c | 55 | cp -a libcycript.dylib package/usr/lib |
107e3ed0 JF |
56 | ln -s /usr/lib/libcycript.dylib package/Library/MobileSubstrate/DynamicLibraries/Cycript.dylib |
57 | cp -a cycript package/usr/bin | |
58 | cp -a libcycript.plist package/usr/lib | |
88c977fa JF |
59 | dpkg-deb -b package $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb |
60 | ||
61 | .PHONY: all clean extra package |