From dfa452c24c8748686523f5bd40436815ba516d95 Mon Sep 17 00:00:00 2001
From: "Jay Freeman (saurik)" <saurik@saurik.com>
Date: Thu, 22 Oct 2009 09:26:07 +0000
Subject: [PATCH] Ported back to the iPhone.

---
 Darwin-arm.mk | 2 +-
 Darwin.mk     | 5 +++--
 makefile      | 8 ++++----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/Darwin-arm.mk b/Darwin-arm.mk
index 875f25f..974a576 100644
--- a/Darwin-arm.mk
+++ b/Darwin-arm.mk
@@ -4,7 +4,7 @@ all += Cycript.$(dll) #cyrver
 
 arch := iphoneos-arm
 ldid := ldid -S
-link += -framework UIKit
+console += -framework UIKit
 
 Cycript.$(dll): Connector.o
 	$(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
diff --git a/Darwin.mk b/Darwin.mk
index a36cdb4..0d9a083 100644
--- a/Darwin.mk
+++ b/Darwin.mk
@@ -5,11 +5,12 @@ header += Struct.hpp ObjectiveC.hpp
 code += ObjectiveC.o Library.o
 filters += ObjC
 flags += -DCY_ATTACH -DCY_EXECUTE
-flags += -lobjc -framework CoreFoundation
-link += -framework Foundation
+link += -lobjc -framework CoreFoundation
+console += -framework Foundation
 library += -install_name /usr/lib/libcycript.$(dll)
 library += -framework Foundation -framework CFNetwork
 library += -framework JavaScriptCore -framework WebCore
+library += -lsubstrate
 
 Struct.hpp:
 	$$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
diff --git a/makefile b/makefile
index 2f95a53..4a7ded5 100644
--- a/makefile
+++ b/makefile
@@ -29,8 +29,8 @@ filters := C
 ldid := echo
 dll := so
 apr := $(shell apr-1-config --link-ld)
-library := $(apr) -lffi #-lsubstrate
-link := $(apr) -lreadline
+library := $(apr) -lffi
+console := $(apr) -lreadline
 
 uname_s := $(shell uname -s)
 uname_p := $(shell uname -p)
@@ -110,11 +110,11 @@ lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
 	$(target)g++ $(flags) -c -o $@ $<
 
 libcycript.$(dll): $(code)
-	$(target)g++ $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library)
+	$(target)g++ $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library) $(link)
 	$(ldid) -S $@
 
 cycript: Console.o libcycript.$(dll)
-	$(target)g++ $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(link)
+	$(target)g++ $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(console) $(link)
 	$(ldid) -S cycript
 
 package: $(deb)
-- 
2.45.2