]> git.saurik.com Git - cycript.git/commitdiff
Further makefile reorganization, header file fixes, code movement, and general massag...
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 22 Oct 2009 09:10:31 +0000 (09:10 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 22 Oct 2009 09:10:31 +0000 (09:10 +0000)
15 files changed:
Connector.cpp
Console.cpp
Darwin-arm.mk
Darwin.mk
FreeBSD.mk
Library.mm
Linux.mk [new file with mode: 0644]
Parser.cpp [new file with mode: 0644]
Pooling.hpp
Server.cpp
cycript.hpp
makefile
sig/ffi_type.hpp
sig/parse.cpp
sig/parse.hpp

index f73022f825cda41e116a8d229028382e7ba8a2d4..473309f2826665eed70b8d3a28486932e824512e 100644 (file)
@@ -8,7 +8,7 @@
 #include <netinet/in.h>
 #include <sys/un.h>
 
-#include <apr-1/apr_thread_proc.h>
+#include <apr_thread_proc.h>
 
 #include <fcntl.h>
 #include <unistd.h>
index dfc5c8c497dec9ec719c2ad0b98958e4b4a0d50c..503a3e8c811fd80ab11291c4232e812d6d3dc469 100644 (file)
@@ -37,8 +37,6 @@
 */
 /* }}} */
 
-#define _GNU_SOURCE
-
 #include "cycript.hpp"
 
 #include <cstdio>
@@ -419,8 +417,10 @@ int main(int argc, char *argv[]) {
     if (optind == argc)
         script = NULL;
     else {
+#ifdef CY_EXECUTE
         // XXX: const_cast?! wtf gcc :(
         CYSetArgs(argc - optind - 1, const_cast<const char **>(argv + optind + 1));
+#endif
         script = argv[optind];
         if (strcmp(script, "-") == 0)
             script = NULL;
index 49139e1337fce77295ddd11d1c48890986e3bff6..875f25f96d56be4dd4fdaff47357007c7d522fa9 100644 (file)
@@ -3,9 +3,16 @@ flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks
 all += Cycript.$(dll) #cyrver
 
 arch := iphoneos-arm
+ldid := ldid -S
+link += -framework UIKit
 
 Cycript.$(dll): Connector.o
        $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
            -lobjc -lapr-1 -lsubstrate \
            -framework CoreFoundation
        ldid -S $@
+
+cyrver: Server.o
+       $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
+           -lapr-1 -lsubstrate -framework CFNetwork
+       $(ldid) $@
index e98526d444904d48440c999f0ba25460ce34ea82..a36cdb428431f2c5a989b700930baca8b5584231 100644 (file)
--- a/Darwin.mk
+++ b/Darwin.mk
@@ -1,11 +1,15 @@
-dll := dylib
-
 # XXX: objective-c exists on non-Darwin
 
+dll := dylib
 header += Struct.hpp ObjectiveC.hpp
 code += ObjectiveC.o Library.o
 filters += ObjC
 flags += -DCY_ATTACH -DCY_EXECUTE
+flags += -lobjc -framework CoreFoundation
+link += -framework Foundation
+library += -install_name /usr/lib/libcycript.$(dll)
+library += -framework Foundation -framework CFNetwork
+library += -framework JavaScriptCore -framework WebCore
 
 Struct.hpp:
        $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
index 34e44e99ffbdf755fe05bb725364efff65077010..d079b9621339e92456d6f7ac2f3c558cbaad874a 100644 (file)
@@ -1,3 +1,2 @@
-export PATH :=/usr/local/bin:$(PATH)
-
+export PATH := /usr/local/bin:$(PATH)
 flags += -I/usr/local/include -I/usr/local/include/webkit-1.0
index c33d160fd799753919aff9dc56713520a06ff04b..33570807cedd2f405615b94e11139d743eea574b 100644 (file)
@@ -67,7 +67,7 @@
 #include "Parser.hpp"
 #include "Cycript.tab.hh"
 
-#include <apr-1/apr_thread_proc.h>
+#include <apr_thread_proc.h>
 
 #undef _assert
 #undef _trace
@@ -1280,10 +1280,6 @@ NSString *NSCFType$cy$toJSON(id self, SEL sel, NSString *key) {
 
 @end
 
-CYRange DigitRange_    (0x3ff000000000000LLU, 0x000000000000000LLU); // 0-9
-CYRange WordStartRange_(0x000001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$
-CYRange WordEndRange_  (0x3ff001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$0-9
-
 #define CYTry \
     @try
 #define CYCatch \
@@ -3317,41 +3313,6 @@ static JSStaticFunction Type_staticFunctions[4] = {
     {NULL, NULL, 0}
 };
 
-CYDriver::CYDriver(const std::string &filename) :
-    state_(CYClear),
-    data_(NULL),
-    size_(0),
-    file_(NULL),
-    strict_(false),
-    filename_(filename),
-    program_(NULL)
-{
-    ScannerInit();
-}
-
-CYDriver::~CYDriver() {
-    ScannerDestroy();
-}
-
-void CYDriver::Warning(const cy::location &location, const char *message) {
-    if (!strict_)
-        return;
-
-    CYDriver::Error error;
-    error.warning_ = true;
-    error.location_ = location;
-    error.message_ = message;
-    errors_.push_back(error);
-}
-
-void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
-    CYDriver::Error error;
-    error.warning_ = false;
-    error.location_ = location;
-    error.message_ = message;
-    driver.errors_.push_back(error);
-}
-
 void CYSetArgs(int argc, const char *argv[]) {
     JSContextRef context(CYGetJSContext());
     JSValueRef args[argc];
diff --git a/Linux.mk b/Linux.mk
new file mode 100644 (file)
index 0000000..5fcb054
--- /dev/null
+++ b/Linux.mk
@@ -0,0 +1,3 @@
+export PATH := /usr/local/bin:$(PATH)
+flags += -I/usr/include/webkit-1.0
+flags += -fPIC
diff --git a/Parser.cpp b/Parser.cpp
new file mode 100644 (file)
index 0000000..35ac7f7
--- /dev/null
@@ -0,0 +1,41 @@
+#include "Parser.hpp"
+#include "Cycript.tab.hh"
+
+CYRange DigitRange_    (0x3ff000000000000LLU, 0x000000000000000LLU); // 0-9
+CYRange WordStartRange_(0x000001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$
+CYRange WordEndRange_  (0x3ff001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$0-9
+
+CYDriver::CYDriver(const std::string &filename) :
+    state_(CYClear),
+    data_(NULL),
+    size_(0),
+    file_(NULL),
+    strict_(false),
+    filename_(filename),
+    program_(NULL)
+{
+    ScannerInit();
+}
+
+CYDriver::~CYDriver() {
+    ScannerDestroy();
+}
+
+void CYDriver::Warning(const cy::location &location, const char *message) {
+    if (!strict_)
+        return;
+
+    CYDriver::Error error;
+    error.warning_ = true;
+    error.location_ = location;
+    error.message_ = message;
+    errors_.push_back(error);
+}
+
+void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
+    CYDriver::Error error;
+    error.warning_ = false;
+    error.location_ = location;
+    error.message_ = message;
+    driver.errors_.push_back(error);
+}
index 73f1c805fe8620ec1c79e04679558440566ef926..84adad2c04a03e52ee6ebb2bdc738f61edc0e586 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef CYPOOLING_HPP
 #define CYPOOLING_HPP
 
-#include <apr-1/apr_pools.h>
-#include <apr-1/apr_strings.h>
+#include <apr_pools.h>
+#include <apr_strings.h>
 
 #include <minimal/stdlib.h>
 
index bf7c17c19ed0a7f8c784995625a7eb25ede411f3..2ecb8bb24ab2a88df3979191aac24e9680ed3eea 100644 (file)
@@ -39,7 +39,7 @@
 
 #include <Pooling.hpp>
 
-#include <apr-1/apr_thread_proc.h>
+#include <apr_thread_proc.h>
 
 #include <CoreFoundation/CFLogUtilities.h>
 #include <CFNetwork/CFNetwork.h>
index 0ff8377bdb96e52b2180cf18d96b94aac944ae6a..b789731e4da737ec508209cb4f491735489089b9 100644 (file)
@@ -46,7 +46,7 @@
 
 #include <JavaScriptCore/JavaScript.h>
 
-#include <apr-1/apr_pools.h>
+#include <apr_pools.h>
 #include <ffi.h>
 
 #include <sig/types.hpp>
index cdf41e9d752882ce1f80196a71f8454ee97b3ffb..2f95a531e5efd3f3c87406e5b49609837d8836c8 100644 (file)
--- a/makefile
+++ b/makefile
@@ -6,12 +6,11 @@ endif
 
 #flags := -g3 -O0 -DYYDEBUG=1
 flags := -g0 -O3
-flags += -Wall -Werror -I. -fno-common
+flags += -Wall -Werror -Wno-parentheses -I. -fno-common
+flags += -I$(shell apr-1-config --includedir)
 
 svn := $(shell svnversion)
 
-filters := C
-
 all:
 all := libcycript.plist cycript
 
@@ -21,9 +20,17 @@ arch := $(shell $(dpkg_architecture) -qDEB_HOST_ARCH 2>/dev/null)
 endif
 
 header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
-code := ffi_type.o parse.o Replace.o Output.o Cycript.tab.o lex.cy.o Network.o
+code := ffi_type.o parse.o 
+code += Replace.o Output.o
+code += Cycript.tab.o lex.cy.o
+code += Network.o Parser.o
 
+filters := C
+ldid := echo
 dll := so
+apr := $(shell apr-1-config --link-ld)
+library := $(apr) -lffi #-lsubstrate
+link := $(apr) -lreadline
 
 uname_s := $(shell uname -s)
 uname_p := $(shell uname -p)
@@ -102,28 +109,13 @@ lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
 %.o: %.mm $(header)
        $(target)g++ $(flags) -c -o $@ $<
 
-cyrver: Server.o
-       $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
-           -lobjc -lapr-1 -lsubstrate \
-           -framework CoreFoundation -framework CFNetwork
-       ldid -S $@
-
 libcycript.$(dll): $(code)
-       $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
-           -install_name /usr/lib/libcycript.$(dll) \
-           -lobjc -lapr-1 -lffi -lsubstrate \
-           -framework CoreFoundation -framework Foundation \
-           -framework CFNetwork \
-           -framework JavaScriptCore -framework WebCore
-       ldid -S $@
+       $(target)g++ $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library)
+       $(ldid) -S $@
 
 cycript: Console.o libcycript.$(dll)
-       $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
-           -lobjc -lapr-1 -lreadline \
-           -L. -lcycript \
-           -framework Foundation -framework CoreFoundation \
-           -framework JavaScriptCore -framework UIKit
-       ldid -S cycript
+       $(target)g++ $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(link)
+       $(ldid) -S cycript
 
 package: $(deb)
 
index 813386aa4e253cb306e5d219b621ffa8e9fae450..0257d27f3879ed5c959bd9320f4c1c7be637442e 100644 (file)
@@ -40,7 +40,7 @@
 #ifndef SIG_FFI_TYPE_H
 #define SIG_FFI_TYPE_H
 
-#include <apr-1/apr_pools.h>
+#include <apr_pools.h>
 #include <ffi.h>
 
 #include "sig/types.hpp"
index 2f007de986ba67abc9d3c1f43e047162bca0b8fc..a359e5419c097990f422d829d5740c916787ff15 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "minimal/stdlib.h"
 
-#include <apr-1/apr_strings.h>
+#include <apr_strings.h>
 
 #include <string.h>
 
index 5607ad31f1994f8efad665dee39c8a0d0262e078..c569a07872e8cde5f714efcdee45a471a7c97862 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "sig/types.hpp"
 
-#include <apr-1/apr_pools.h>
+#include <apr_pools.h>
 
 namespace sig {