ide: PORTABLE_HYBRID

This commit is contained in:
Mirek Fidler 2026-04-22 09:42:27 +02:00
parent 4544393d53
commit 2f2f7a4af6
3 changed files with 28 additions and 15 deletions

View file

@ -13,5 +13,6 @@ file
mainconfig
"" = "GUI",
"" = "GUI FORCE_CSD",
"" = "GUI X11";
"" = "GUI X11",
"" = "GUI X11 PORTABLE_HYBRID";

View file

@ -8,6 +8,8 @@ uses
library(WIN32) "advapi32 comdlg32 comctl32 imm32";
library(PORTABLE_HYBRID) "brotlidec brotlicommon bz2 Xau";
pkg_config(POSIX !OSX !VIRTUALGUI) "freetype2 x11 xinerama xrender xft xdmcp fontconfig xcb xext";
pkg_config(POSIX !X11 !OSX !VIRTUALGUI) "gtk+-3.0 libnotify";

View file

@ -50,7 +50,7 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile, V
}
SaveBuildInfo(package);
int i;
Package pkg;
pkg.Load(PackageFile(package));
@ -68,13 +68,13 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile, V
bool error = false;
String pch_header;
Index<String> nopch, noblitz;
bool blitz = HasFlag("BLITZ");
bool release = !HasFlag("DEBUG");
bool objectivec = HasFlag("OBJC");
if(HasFlag("OSX"))
objectivec = true;
@ -143,7 +143,7 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile, V
}
}
}
String cc = CmdLine(package, pkg);
// if(IsVerbose())
@ -208,12 +208,12 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile, V
String pch_use;
String pch_file;
if(recompile > 2 && pch_header.GetCount()) {
String pch_header2 = CatAnyPath(outdir, GetFileTitle(pch_header) + "$pch.h");
pch_file = pch_header2 + ".gch";
SaveFile(pch_header2, "#include <" + pch_header + ">"); // CLANG needs a copy of header
int pch_slot = AllocSlot();
StringBuffer sb;
@ -328,7 +328,7 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile, V
MergeWith(linkoptions, " ", Gather(pkg.link, config.GetKeys()));
if(linkoptions.GetCount())
linkoptions << ' ';
bool making_lib = HasFlag("MAKE_LIB") || HasFlag("MAKE_MLIB");
if(!making_lib) {
@ -411,7 +411,7 @@ bool GccBuilder::CreateLib(const String& product, const Vector<String>& obj,
llib << ' ' << GetPathQ(GetSharedLibPath(all_uses[i]));
for(int i = 0; i < all_libraries.GetCount(); i++)
llib << " -l" << GetPathQ(all_libraries[i]);
if(HasFlag("POSIX"))
llib << " -Wl,-soname," << GetSoname(product);
}
@ -443,7 +443,7 @@ bool GccBuilder::CreateLib(const String& product, const Vector<String>& obj,
// replace all '\' with '/'`
llib = UnixPath(llib);
out << llib.Left(found);
#ifdef PLATFORM_WIN32
out << '\r';
@ -500,11 +500,12 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
if(!Wait())
return false;
PutLinking();
if(HasFlag("MAKE_MLIB") || HasFlag("MAKE_LIB"))
return CreateLib(ForceExt(target, ".a"), linkfile, Vector<String>(), Vector<String>(), linkoptions);
int time = msecs();
bool portable = HasFlag("PORTABLE_HYBRID");
#ifdef PLATFORM_OSX
CocoaAppBundle();
#endif
@ -518,6 +519,9 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
lnk << " -m32";
if(HasFlag("DLL"))
lnk << " -shared";
if(portable)
lnk << " -static-libstdc++ -static-libgcc -Wl,-Bstatic";
else
if(!HasFlag("SHARED") && !HasFlag("SO"))
lnk << " -static";
if(HasFlag("WINCE"))
@ -558,7 +562,7 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
String linklistM = "Producing link file list ...\n";
String odir = GetFileDirectory(linkfile[0]);
lfilename << GetFileFolder(linkfile[0]) << ".LinkFileList";
linklistM << lfilename;
UPP::SaveFile(lfilename, linklist);
lnk << " -L" << GetPathQ(odir)
@ -580,8 +584,11 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
for(int pass = 0; pass < 2; pass++) {
for(i = 0; i < lib.GetCount(); i++) {
String ln = lib[i];
if(portable && (ln == "dl" || ln == "pthread" || ln == "rt"))
continue;
String ext = ToLower(GetFileExt(ln));
// unix shared libs shall have version number AFTER .so (sic)
// so we shall find the true extension....
if(HasFlag("POSIX") && ext != ".so")
@ -594,7 +601,7 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
if(pos >= 0 && ToLower(ln.Mid(pos, 3)) == ".so")
ext = ".so";
}
if(pass == 0) {
if(ext == ".a")
lnk << ' ' << GetPathQ(FindInDirs(libpath, lib[i]));
@ -610,6 +617,9 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
if(pass == 1 && !HasFlag("SOLARIS") && !HasFlag("OSX"))
lnk << " -Wl,--end-group";
}
if(portable)
lnk << " -Wl,-Bdynamic -lpthread -ldl -lrt";
PutConsole("Linking...");
bool error = false;
CustomStep(".pre-link", Null, error);
@ -661,4 +671,4 @@ INITIALIZER(GccBuilder)
{
RegisterBuilder("GCC", CreateGccBuilder);
RegisterBuilder("CLANG", CreateGccBuilder);
}
}