Commits

Anonymous committed 3dd562b

* restored linking to shared binaries with -l instead of relative paths

  • Participants
  • Parent commits 4a0c205

Comments (0)

Files changed (2)

File src/host/premake.c

 #endif
 
 
-#define VERSION        "CL-2013.05.23"
+#define VERSION        "CL-2013.06.08"
 #define COPYRIGHT      "Copyright (C) 2002-2013 Jason Perkins and the Premake Project"
 #define PROJECT_URL    "https://bitbucket.org/premake/premake-stable/wiki"
 #define ERROR_MESSAGE  "%s\n"

File src/tools/gcc.lua

 
 	function gcc.getlinks(cfg, systemonly)
 		local result = {}
-
+		--[[
+		-- Don't use the official premake implementation - it causes
+		-- libraries to be searched with relative paths from the executable.
+		-- This can be solved with -soname linker option, but this forces
+		-- a linkage pattern to our clients
+		
 		-- Don't use the -l form for sibling libraries, since they may have
 		-- custom prefixes or extensions that will confuse the linker. Instead
 		-- just list out the full relative path to the library.
 		if not systemonly then
 			result = config.getlinks(cfg, "siblings", "fullpath")
 		end
+		--]]
+		if not systemonly then
+			local links = config.getlinks(cfg, "siblings", "object")
+			for _, link in ipairs(links) do
+				-- skip external project references, since I have no way
+				-- to know the actual output target path
+				if not link.project.external then
+					if link.kind == premake.STATICLIB then
+						-- Don't use "-l" flag when linking static libraries; instead use
+						-- path/libname.a to avoid linking a shared library of the same
+						-- name if one is present
+						table.insert(result, project.getrelative(cfg.project, link.linktarget.abspath))
+					else
+						table.insert(result, "-l" .. link.linktarget.basename)
+					end
+				else
+					table.insert(result, "-l" .. link.project.externalname)	
+				end
+			end
+		end
 
 		-- The "-l" flag is fine for system libraries