Commit ffc09a73 authored by Mihai Moldovan's avatar Mihai Moldovan

nx-X11: build programs with a temporary RPATH/RUNPATH value and a relinked…

nx-X11: build programs with a temporary RPATH/RUNPATH value and a relinked version with the system location. While the install target explicitly installs the relinked system-location version of a program, we do not actually use this. Currently, we copy nxagent directly out of the build root.
parent 44f8c424
...@@ -21,6 +21,7 @@ XCOMM --------------------------------------------------------------------- ...@@ -21,6 +21,7 @@ XCOMM ---------------------------------------------------------------------
* _MUseCat (a,b,c) * _MUseCat (a,b,c)
* ProgramTargetName (target) * ProgramTargetName (target)
* HostProgramTargetName (target) * HostProgramTargetName (target)
* ProgramRelinkName (target)
* RunProgram (progvar,options) * RunProgram (progvar,options)
* RunProgramWithSetup (setup,progvar,options) * RunProgramWithSetup (setup,progvar,options)
* RemoveFile (file) * RemoveFile (file)
...@@ -44,6 +45,7 @@ XCOMM --------------------------------------------------------------------- ...@@ -44,6 +45,7 @@ XCOMM ---------------------------------------------------------------------
* BuildIncludes (srclist,dstsubdir,dstupdir) * BuildIncludes (srclist,dstsubdir,dstupdir)
* LinkRule (program,options,objects,libraries) * LinkRule (program,options,objects,libraries)
* HostLinkRule (program,options,objects,libraries) * HostLinkRule (program,options,objects,libraries)
* LinkInstallRule (program,options,objects,libraries)
* NoCmpScript (target) * NoCmpScript (target)
* NoConfigRec (target) * NoConfigRec (target)
* NormalProgramTarget (program,objects,deplibs,locallibs,syslibs) * NormalProgramTarget (program,objects,deplibs,locallibs,syslibs)
...@@ -76,6 +78,7 @@ XCOMM --------------------------------------------------------------------- ...@@ -76,6 +78,7 @@ XCOMM ---------------------------------------------------------------------
* InstallNonExecFileNoClobber (file,dest) * InstallNonExecFileNoClobber (file,dest)
* InstallNonExec (file,dest) * InstallNonExec (file,dest)
* InstallProgramWithFlags (program,dest,flags) * InstallProgramWithFlags (program,dest,flags)
* RelinkProgram (program,objects,libs,syslibs)
* InstallProgram (program,dest) * InstallProgram (program,dest)
* InstallScript (program,dest) * InstallScript (program,dest)
* InstallNamedProg (srcname,dstname,dest) * InstallNamedProg (srcname,dstname,dest)
...@@ -316,6 +319,10 @@ XCOMM special target for clearmake @@\ ...@@ -316,6 +319,10 @@ XCOMM special target for clearmake @@\
#define HostProgramTargetName(target)target #define HostProgramTargetName(target)target
#endif #endif
#ifndef ProgramRelinkName
#define ProgramRelinkName(target)Concat(target,-relink)
#endif
#ifndef RunProgram #ifndef RunProgram
#define RunProgram(progvar,options) $(progvar) options #define RunProgram(progvar,options) $(progvar) options
#endif #endif
...@@ -610,6 +617,14 @@ $(CCLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS) ...@@ -610,6 +617,14 @@ $(CCLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS)
#endif /* LinkRule */ #endif /* LinkRule */
/* /*
* LinkRule - link a program, suitable for later installation
*/
#ifndef LinkInstallRule
#define LinkInstallRule(program,options,objects,libraries) \
$(CCLINK) -o program options objects libraries $(EXTRA_INSTALL_LOAD_FLAGS)
#endif /* LinkInstallRule */
/*
* HostLinkRule - link a utility to be used on the build host * HostLinkRule - link a utility to be used on the build host
* (differs from LinkRule if cross compiling) * (differs from LinkRule if cross compiling)
*/ */
...@@ -1101,6 +1116,7 @@ CplusplusProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib) ...@@ -1101,6 +1116,7 @@ CplusplusProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib)
#ifndef ServerTargetWithFlags #ifndef ServerTargetWithFlags
#define ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\ #define ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\
AllTarget(ProgramTargetName(server)) @@\ AllTarget(ProgramTargetName(server)) @@\
AllTarget(ProgramRelinkName(server)) @@\
ProgramTargetName(server): subdirs objects libs @@\ ProgramTargetName(server): subdirs objects libs @@\
MoveToBakFile($@) @@\ MoveToBakFile($@) @@\
LinkRule($@,$(SERVERLDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\ LinkRule($@,$(SERVERLDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
...@@ -1118,10 +1134,12 @@ PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ ...@@ -1118,10 +1134,12 @@ PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
@@\ @@\
RelinkProgram(ProgramTargetName(server),objects,libs,syslibs) @@\
InstallProgramWithFlags(server,$(BINDIR),flags) @@\ InstallProgramWithFlags(server,$(BINDIR),flags) @@\
@@\ @@\
clean:: @@\ clean:: @@\
RemoveFile(ProgramTargetName(server)) RemoveFile(ProgramTargetName(server)) @@\
RemoveFile(ProgramRelinkName(server))
#endif /* ServerTargetWithFlags */ #endif /* ServerTargetWithFlags */
/* /*
...@@ -1586,17 +1604,28 @@ install:: file @@\ ...@@ -1586,17 +1604,28 @@ install:: file @@\
/* /*
* RelinkProgram - relinks an executable program in preparation of installation
*/
#ifndef RelinkProgram
#define RelinkProgram(program,objects,libs,syslibs) @@\
ProgramRelinkName(program): program @@\
MoveToBakFile($@) @@\
LinkInstallRule($@,$(SERVERLDOPTIONS),objects,libs $(LDLIBS) syslibs)
#endif /* RelinkProgram */
/*
* InstallProgramWithFlags - generate rules to install an executable program * InstallProgramWithFlags - generate rules to install an executable program
* using given install flags. * using given install flags.
*/ */
#ifndef InstallProgramWithFlags #ifndef InstallProgramWithFlags
#if StripInstalledPrograms && CrossCompiling #if StripInstalledPrograms && CrossCompiling
#define InstallProgramWithFlags(program,dest,flags) @@\ #define InstallProgramWithFlags(program,dest,flags) @@\
InstallTarget(install,ProgramTargetName(program),$(INSTPGMFLAGS) flags,dest) @@\ InstallTarget(install,ProgramRelinkName(program),$(INSTPGMFLAGS) flags,dest) @@\
CrossStripCmd $(DESTDIR)dest/ProgramTargetName(program) CrossStripCmd $(DESTDIR)dest/ProgramTargetName(program)
#else #else
#define InstallProgramWithFlags(program,dest,flags) @@\ #define InstallProgramWithFlags(program,dest,flags) @@\
InstallTarget(install,ProgramTargetName(program),$(INSTPGMFLAGS) flags,dest) InstallTarget(install,ProgramRelinkName(program),$(INSTPGMFLAGS) flags,dest)
#endif /* StripInstalledPrograms && CrossCompiling */ #endif /* StripInstalledPrograms && CrossCompiling */
#endif /* InstallProgramWithFlags */ #endif /* InstallProgramWithFlags */
......
...@@ -1846,6 +1846,7 @@ MODLDCOMBINEFLAGS = ModuleLdCombineFlags ...@@ -1846,6 +1846,7 @@ MODLDCOMBINEFLAGS = ModuleLdCombineFlags
STD_DEFINES = StandardDefines $(PROJECT_DEFINES) STD_DEFINES = StandardDefines $(PROJECT_DEFINES)
SETITIMER_DEFINES = HasSetitimerDefines SETITIMER_DEFINES = HasSetitimerDefines
EXTRA_LOAD_FLAGS = ExtraLoadFlags EXTRA_LOAD_FLAGS = ExtraLoadFlags
EXTRA_INSTALL_LOAD_FLAGS = ExtraInstallLoadFlags
EXTRA_LDOPTIONS = ExtraLoadOptions EXTRA_LDOPTIONS = ExtraLoadOptions
EXTRA_LIBRARIES = MallocLibraries ExtraLibraries EXTRA_LIBRARIES = MallocLibraries ExtraLibraries
TAGS = TagsCmd TAGS = TagsCmd
......
...@@ -37,6 +37,7 @@ Imake.tmpl provides defaults for the following variables: ...@@ -37,6 +37,7 @@ Imake.tmpl provides defaults for the following variables:
ExtraFilesToClean extra files to remove on make clean ExtraFilesToClean extra files to remove on make clean
ExtraLibraries system-specific libraries need to link ExtraLibraries system-specific libraries need to link
ExtraLoadFlags system-specific loader flags ExtraLoadFlags system-specific loader flags
ExtraInstallLoadFlags system-specific loader flags for later installation
FileManSuffix man suffix for file format pages FileManSuffix man suffix for file format pages
FilesToClean files to delete in make clean FilesToClean files to delete in make clean
FortranCmd command to run Fortran compiler FortranCmd command to run Fortran compiler
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#define RanlibCmd /opt/Embedix/tools/bin/arm-linux-ranlib #define RanlibCmd /opt/Embedix/tools/bin/arm-linux-ranlib
#undef ExtraLoadFlags #undef ExtraLoadFlags
#define ExtraLoadFlags #define ExtraLoadFlags
#undef ExtraInstallLoadFlags
#define ExtraInstallLoadFlags
#define FbNoPixelAddrCode #define FbNoPixelAddrCode
#undef TermcapLibrary #undef TermcapLibrary
#define TermcapLibrary -ltermcap #define TermcapLibrary -ltermcap
......
...@@ -40,11 +40,18 @@ XCOMM XXX To rpath or not to rpath... ...@@ -40,11 +40,18 @@ XCOMM XXX To rpath or not to rpath...
#endif #endif
#ifndef RpathLoadFlags #ifndef RpathLoadFlags
#if UseRpath #if UseRpath
#define RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath=$(USRLIBDIRPATH) #define RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath=\$$ORIGIN/$(BUILDLIBDIR)
#else #else
#define RpathLoadFlags /**/ #define RpathLoadFlags /**/
#endif #endif
#endif #endif
#ifndef RpathInstallLoadFlags
#if UseRpath
#define RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath=$(USRLIBDIRPATH)
#else
#define RpathInstallLoadFlags /**/
#endif
#endif
#ifndef LibraryRpathLoadFlags #ifndef LibraryRpathLoadFlags
#define LibraryRpathLoadFlags RpathLoadFlags #define LibraryRpathLoadFlags RpathLoadFlags
#endif #endif
...@@ -62,7 +69,15 @@ XCOMM XXX To rpath or not to rpath... ...@@ -62,7 +69,15 @@ XCOMM XXX To rpath or not to rpath...
XCOMM XXX Maybe superfluous. XCOMM XXX Maybe superfluous.
#define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=$(USRLIBDIRPATH) #define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=$(USRLIBDIRPATH)
#else #else
#define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=$(BUILDLIBDIR) #define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=\$$ORIGIN/$(BUILDLIBDIR)
#endif
#endif
#ifndef ExtraInstallLoadFlags
#ifdef UseInstalled
XCOMM XXX Maybe superfluous.
#define ExtraInstallLoadFlags RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=$(USRLIBDIRPATH)
#else
#define ExtraInstallLoadFlags RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=\$$ORIGIN/$(BUILDLIBDIR)
#endif #endif
#endif #endif
......
...@@ -51,11 +51,18 @@ ...@@ -51,11 +51,18 @@
# endif # endif
#ifndef RpathLoadFlags #ifndef RpathLoadFlags
#if UseRpath #if UseRpath
#define RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath,$(USRLIBDIRPATH) #define RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath,\$$ORIGIN/$(BUILDLIBDIR)
#else #else
#define RpathLoadFlags /**/ #define RpathLoadFlags /**/
#endif #endif
#endif #endif
#ifndef RpathInstallLoadFlags
#if UseRpath
#define RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath,$(USRLIBDIRPATH)
#else
#define RpathInstallLoadFlags /**/
#endif
#endif
#ifndef LibraryRpathLoadFlags #ifndef LibraryRpathLoadFlags
#define LibraryRpathLoadFlags RpathLoadFlags #define LibraryRpathLoadFlags RpathLoadFlags
#endif #endif
...@@ -75,12 +82,25 @@ ...@@ -75,12 +82,25 @@
# define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,$(USRLIBDIRPATH) # define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,$(USRLIBDIRPATH)
# endif # endif
# else # else
# define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,$(BUILDLIBDIR) # define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,\$$ORIGIN/$(BUILDLIBDIR)
# endif # endif
# else # else
# define ExtraLoadFlags RpathLoadFlags # define ExtraLoadFlags RpathLoadFlags
# endif # endif
# endif # endif
# ifndef ExtraInstallLoadFlags
# if LinuxBinUtilsMajorVersion >= 26
# ifdef UseInstalled
# if LinuxBinUtilsMajorVersion < 27
# define ExtraInstallLoadFlags RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,$(USRLIBDIRPATH)
# endif
# else
# define ExtraInstallLoadFlags RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,\$$ORIGIN/$(BUILDLIBDIR)
# endif
# else
# define ExtraInstallLoadFlags RpathInstallLoadFlags
# endif
# endif
# ifndef HardCodeLibdirFlag # ifndef HardCodeLibdirFlag
# define HardCodeLibdirFlag RpathLoadFlags # define HardCodeLibdirFlag RpathLoadFlags
# endif # endif
......
...@@ -400,7 +400,7 @@ nxagent_static: nxagent ...@@ -400,7 +400,7 @@ nxagent_static: nxagent
else exit 0; fi else exit 0; fi
$(CCLINK) -o nxagent_static -static $(LDOPTIONS) $(NXAGENTOBJS) \ $(CCLINK) -o nxagent_static -static $(LDOPTIONS) $(NXAGENTOBJS) \
$(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS) $(LDLIBS) \ $(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS) $(LDLIBS) \
$(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS) $(EXTRA_LOAD_FLAGS) $(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS) $(EXTRA_INSTALL_LOAD_FLAGS)
/* /*
* Hard coded target to build a static nxagent server except for libX11 and libXext. * Hard coded target to build a static nxagent server except for libX11 and libXext.
...@@ -411,7 +411,7 @@ nxagent_static_nolibs: nxagent ...@@ -411,7 +411,7 @@ nxagent_static_nolibs: nxagent
else exit 0; fi else exit 0; fi
$(CCLINK) -o nxagent_static_nolibs -Wl,-Bstatic $(LDOPTIONS) $(NXAGENTOBJS) \ $(CCLINK) -o nxagent_static_nolibs -Wl,-Bstatic $(LDOPTIONS) $(NXAGENTOBJS) \
$(NXAGENTLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER) $(LDLIBS) \ $(NXAGENTLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER) $(LDLIBS) \
$(LDPRELIBS) $(SYSLIBS) -Wl,-Bdynamic -lNX_X11 -lXext $(EXTRA_LOAD_FLAGS) $(LDPRELIBS) $(SYSLIBS) -Wl,-Bdynamic -lNX_X11 -lXext $(EXTRA_INSTALL_LOAD_FLAGS)
#endif /* NXAgentServer */ #endif /* NXAgentServer */
#if defined(NXWinServer) && NXWinServer #if defined(NXWinServer) && NXWinServer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment