Remove hardcoded paths

The gyp files made some assumptions about where they were
in relation to each other, and that makes it tough to use
them as dependencies in a new project. This CL makes all
of the paths relative.

It also changes how the lib search path is defined. The
previous version placed a -L option in cflags. This
prevents the gyp generators from modifying the path,
so if you change to a different directory for output,
all of the third-party libs disappear. Fixed by specifying
the search path using gyp's library_dirs variable. Tested
with the ninja and cmake generators.

Change-Id: I489bfa33a97d28df0af77a699896be180ca9384b
Reviewed-on: https://weave-review.googlesource.com/1441
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/libweave/examples/daemon/daemon.gyp b/libweave/examples/daemon/daemon.gyp
index f421601..c6f8837 100644
--- a/libweave/examples/daemon/daemon.gyp
+++ b/libweave/examples/daemon/daemon.gyp
@@ -10,8 +10,8 @@
         'main.cc',
       ],
       'dependencies': [
-        '../../libweave_standalone.gyp:libweave',
-        '../provider/provider.gyp:libweave_provider',
+        '<@(DEPTH)/libweave_standalone.gyp:libweave',
+        '<@(DEPTH)/examples/provider/provider.gyp:libweave_provider',
       ]
     }
   ]
diff --git a/libweave/examples/provider/provider.gyp b/libweave/examples/provider/provider.gyp
index 9dcf184..3d13d8f 100644
--- a/libweave/examples/provider/provider.gyp
+++ b/libweave/examples/provider/provider.gyp
@@ -32,7 +32,7 @@
         'ssl_stream.cc',
       ],
       'dependencies': [
-        '../../libweave_standalone.gyp:libweave',
+        '<@(DEPTH)/libweave_standalone.gyp:libweave',
       ],
       'direct_dependent_settings' : {
         'variables': {
diff --git a/libweave/libweave_common.gypi b/libweave/libweave_common.gypi
index bf81f76..49f7ff9 100644
--- a/libweave/libweave_common.gypi
+++ b/libweave/libweave_common.gypi
@@ -47,8 +47,6 @@
       '-Wpointer-arith',
       '-Wwrite-strings',
     ],
-    'libraries': [
-      '-L../../third_party/lib',
-    ],
+    'library_dirs': ['third_party/lib']
   },
 }
diff --git a/libweave/libweave_standalone.gyp b/libweave/libweave_standalone.gyp
index 6b73f84..fd87f16 100644
--- a/libweave/libweave_standalone.gyp
+++ b/libweave/libweave_standalone.gyp
@@ -8,9 +8,9 @@
   'target_defaults': {
     'libraries': [
       '-lcrypto',
-      '-lexpat',
       '-lgtest',
       '-lgmock',
+      '-lexpat',
       '-lpthread',
     ],
   },
@@ -19,7 +19,7 @@
       'target_name': 'libweave_common',
       'type': 'static_library',
       'include_dirs': [
-        '../libweave/external',
+        '<@(DEPTH)/external',
       ],
       'sources': [
         '<@(weave_sources)',
@@ -44,7 +44,7 @@
       'type': 'static_library',
       'standalone_static_library': 1,
       'include_dirs': [
-        '../libweave/external',
+        '<@(DEPTH)/external',
       ],
       'sources': [
         '<@(weave_test_sources)',
@@ -54,7 +54,7 @@
       'target_name': 'libweave_testrunner',
       'type': 'executable',
       'include_dirs': [
-        '../libweave/external',
+        '<@(DEPTH)/external',
       ],
       'dependencies': [
         'libweave_common',
@@ -69,7 +69,7 @@
       'target_name': 'libweave_exports_testrunner',
       'type': 'executable',
       'include_dirs': [
-        '../libweave/external',
+        '<@(DEPTH)/external',
       ],
       'dependencies': [
         'libweave',