mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Add -rpath to linker flags pointing to install directory
This removes the need to have the intermediate shell script that updates the LD_LIBRARY_PATH environment variable
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
INSTALLDIR=/usr/share/atom
|
||||
|
||||
CXXFLAGS := -Werror \
|
||||
-pthread \
|
||||
-fno-exceptions \
|
||||
@@ -36,6 +38,7 @@ LDFLAGS := -pthread \
|
||||
-Wl,-O1 \
|
||||
-Wl,--as-needed \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,-rpath=$(INSTALLDIR)
|
||||
|
||||
LIBS := -lX11 \
|
||||
-lgtk-x11-2.0 \
|
||||
@@ -61,24 +64,23 @@ LIBS := -lX11 \
|
||||
|
||||
SOURCES=atom.cpp native_handler.cpp client_handler.cpp onig_regexp_extension.cpp io_utils.cpp
|
||||
OBJECTS=$(SOURCES:.cpp=.o)
|
||||
INSTALLDIR=/usr/local/atom
|
||||
|
||||
all:
|
||||
g++ $(CXXFLAGS) -c $(SOURCES)
|
||||
mkdir -p bin
|
||||
cp chrome.pak bin/
|
||||
cp -R locales bin/
|
||||
cp atom.png bin/
|
||||
g++ -o bin/atom $(OBJECTS) $(LDFLAGS) $(LIBS)
|
||||
g++ -o atom $(OBJECTS) $(LDFLAGS) $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -rf bin *.o
|
||||
rm -rf atom *.o
|
||||
|
||||
install:
|
||||
mkdir -p $(INSTALLDIR)
|
||||
cp -R bin $(INSTALLDIR)
|
||||
cp -R lib $(INSTALLDIR)
|
||||
cp atom $(INSTALLDIR)
|
||||
cp -R atom $(INSTALLDIR)
|
||||
cp chrome.pak $(INSTALLDIR)
|
||||
cp -R locales $(INSTALLDIR)
|
||||
cp atom.png $(INSTALLDIR)
|
||||
cp lib/libcef.so $(INSTALLDIR)
|
||||
cp lib/libcef_dll_wrapper.a $(INSTALLDIR)
|
||||
cp -R ../src $(INSTALLDIR)
|
||||
cp -R ../static $(INSTALLDIR)
|
||||
cp -R ../vendor $(INSTALLDIR)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
case $0 in
|
||||
/* )
|
||||
root=${0%atom}
|
||||
;;
|
||||
* )
|
||||
root=`pwd`/${0%atom}
|
||||
;;
|
||||
esac
|
||||
export LD_LIBRARY_PATH=$root'../atom/lib':$LD_LIBRARY_PATH
|
||||
$root'../atom/bin/atom' $@
|
||||
@@ -3,7 +3,6 @@
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include "atom.h"
|
||||
@@ -59,9 +58,11 @@ int main(int argc, char *argv[]) {
|
||||
if (szWorkingDir == NULL)
|
||||
return -1;
|
||||
|
||||
std::string fullPath = argv[0];
|
||||
fullPath = fullPath.substr(0, fullPath.length() - 5);
|
||||
szPath = fullPath.c_str();
|
||||
std::string appDir = io_util_app_directory();
|
||||
if (appDir.empty())
|
||||
return -1;
|
||||
|
||||
szPath = appDir.c_str();
|
||||
|
||||
std::string pathToOpen;
|
||||
if (argc >= 2) {
|
||||
@@ -111,7 +112,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
window_info.SetAsChild(vbox);
|
||||
|
||||
std::string path = io_utils_real_app_path("/../index.html");
|
||||
std::string path = io_utils_real_app_path("/index.html");
|
||||
if (path.empty())
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "include/cef_frame.h"
|
||||
#include "atom.h"
|
||||
#include "native_handler.h"
|
||||
#include "io_utils.h"
|
||||
#include "atom.h"
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -92,11 +92,8 @@ void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefV8Value> atom = CefV8Value::CreateObject(NULL, NULL);
|
||||
global->SetValue("atom", atom, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
||||
std::string realLoadPath = io_utils_real_app_path("/..");
|
||||
if (!realLoadPath.empty()) {
|
||||
CefRefPtr<CefV8Value> loadPath = CefV8Value::CreateString(realLoadPath);
|
||||
atom->SetValue("loadPath", loadPath, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
}
|
||||
CefRefPtr<CefV8Value> loadPath = CefV8Value::CreateString(AppPath());
|
||||
atom->SetValue("loadPath", loadPath, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
||||
CefRefPtr<CefV8Value> bootstrapScript = CefV8Value::CreateString(
|
||||
"single-window-bootstrap");
|
||||
|
||||
@@ -33,4 +33,17 @@ string io_utils_real_app_path(string relativePath) {
|
||||
return realAppPath;
|
||||
} else
|
||||
return "";
|
||||
}
|
||||
|
||||
string io_util_app_directory() {
|
||||
char path[BUFFER_SIZE];
|
||||
if (readlink("/proc/self/exe", path, BUFFER_SIZE) < 2)
|
||||
return "";
|
||||
|
||||
string appPath(path);
|
||||
unsigned int lastSlash = appPath.rfind("/");
|
||||
if (lastSlash != string::npos)
|
||||
return appPath.substr(0, lastSlash);
|
||||
else
|
||||
return appPath;
|
||||
}
|
||||
@@ -14,4 +14,9 @@ int io_utils_read(std::string path, std::string* output);
|
||||
*/
|
||||
std::string io_utils_real_app_path(std::string relativePath);
|
||||
|
||||
/**
|
||||
* Get path to directory where atom app resides
|
||||
*/
|
||||
std::string io_util_app_directory();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -127,7 +127,7 @@ IMPLEMENT_REFCOUNTING(OnigRegexpUserData)
|
||||
OnigRegexpExtension::OnigRegexpExtension() :
|
||||
CefV8Handler() {
|
||||
string realFilePath = io_utils_real_app_path(
|
||||
"/../src/stdlib/onig-reg-exp-extension.js");
|
||||
"/src/stdlib/onig-reg-exp-extension.js");
|
||||
if (!realFilePath.empty()) {
|
||||
string extensionCode;
|
||||
if (io_utils_read(realFilePath, &extensionCode) > 0)
|
||||
|
||||
Reference in New Issue
Block a user