Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Don't copy libraries that are already in prime. #580
Merged
sergiusens
merged 4 commits into
snapcore:master
from
kyrofa:bugfix/1570895/relative_rpath
Jun 24, 2016
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
Jump to file or symbol
Failed to load files and symbols.
| @@ -0,0 +1,10 @@ | ||
| +name: rpath-test | ||
| +version: 1 | ||
| +summary: summary | ||
| +description: description | ||
| +confinement: strict | ||
| + | ||
| +parts: | ||
| + rpath-test: | ||
| + plugin: make | ||
| + source: src/ |
| @@ -0,0 +1,19 @@ | ||
| +all: main | ||
| + | ||
| +libfoo.so: foo.h foo.cpp | ||
| + @g++ -fPIC -c foo.cpp | ||
| + @g++ -shared foo.o -o libfoo.so | ||
| + @mkdir -p lib | ||
| + @mv libfoo.so lib/ | ||
| + | ||
| +main: libfoo.so | ||
| + @g++ main.cpp -o binary -Wl,-rpath=\$$ORIGIN/lib -Llib -lfoo | ||
| + | ||
| +install: main | ||
| + @mkdir -p $(DESTDIR)/lib | ||
| + @cp binary $(DESTDIR)/ | ||
| + @cp lib/* $(DESTDIR)/lib/ | ||
| + | ||
| +clean: | ||
| + @rm *.o binary | ||
| + @rm -rf lib |
| @@ -0,0 +1,6 @@ | ||
| +#include "foo.h" | ||
| + | ||
| +std::string foo() | ||
| +{ | ||
| + return "hello world"; | ||
| +} |
| @@ -0,0 +1,3 @@ | ||
| +#include <string> | ||
| + | ||
| +std::string foo(); |
| @@ -0,0 +1,8 @@ | ||
| +#include <iostream> | ||
| +#include "foo.h" | ||
| + | ||
| +int main() | ||
| +{ | ||
| + std::cout << foo() << std::endl; | ||
| + return 0; | ||
| +} |
| @@ -0,0 +1,43 @@ | ||
| +# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- | ||
| +# | ||
| +# Copyright (C) 2016 Canonical Ltd | ||
| +# | ||
| +# This program is free software: you can redistribute it and/or modify | ||
| +# it under the terms of the GNU General Public License version 3 as | ||
| +# published by the Free Software Foundation. | ||
| +# | ||
| +# This program is distributed in the hope that it will be useful, | ||
| +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| +# GNU General Public License for more details. | ||
| +# | ||
| +# You should have received a copy of the GNU General Public License | ||
| +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| + | ||
| +import os | ||
| + | ||
| +import integration_tests | ||
| + | ||
| +from testtools.matchers import ( | ||
| + DirExists, | ||
| + FileExists, | ||
| + Not, | ||
| +) | ||
| + | ||
| + | ||
| +class RpathTestCase(integration_tests.TestCase): | ||
| + | ||
| + def test_origin_rpath(self): | ||
| + project_dir = 'rpath-test' | ||
| + self.run_snapcraft('prime', project_dir) | ||
| + | ||
| + primedir = os.path.join(project_dir, 'prime') | ||
| + self.assertThat(os.path.join(primedir, 'binary'), FileExists()) | ||
| + self.assertThat( | ||
| + os.path.join(primedir, 'lib', 'libfoo.so'), FileExists()) | ||
| + | ||
| + # Assert that the $ORIGIN rpath did not result in the library being pulled | ||
| + # in twice. | ||
| + self.assertThat( | ||
| + os.path.join(primedir, os.path.abspath(primedir).lstrip('/')), | ||
| + Not(DirExists())) |