Enable binreloc for OS X.

This commit is contained in:
David Anderson 2014-07-23 23:21:03 -07:00
parent 654dcd8ff0
commit f41b3a2b06
2 changed files with 12 additions and 16 deletions

View File

@ -70,7 +70,7 @@ binary.sources += [
'zlib/zutil.c', 'zlib/zutil.c',
'sp_symhash.c' 'sp_symhash.c'
] ]
if builder.target_platform == 'linux': if builder.target_platform != 'windows':
binary.sources.append('binreloc.c') binary.sources.append('binreloc.c')
SM.spcomp = builder.Add(binary) SM.spcomp = builder.Add(binary)

View File

@ -1192,35 +1192,31 @@ static void setopt(int argc,char **argv,char *oname,char *ename,char *pname,
} }
#if defined __BORLANDC__ || defined __WATCOMC__ #if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused # pragma argsused
#endif #endif
static void setconfig(char *root) static void setconfig(char *root)
{ {
#if defined macintosh
insert_path(":include:");
#else
char path[_MAX_PATH]; char path[_MAX_PATH];
char *ptr,*base; char *ptr,*base;
int len; int len;
/* add the default "include" directory */ /* add the default "include" directory */
#if defined __WIN32__ || defined _WIN32 #if defined __WIN32__ || defined _WIN32
GetModuleFileNameA(NULL,path,_MAX_PATH); GetModuleFileNameA(NULL,path,_MAX_PATH);
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ #elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined DARWIN
/* see www.autopackage.org for the BinReloc module */ /* see www.autopackage.org for the BinReloc module */
br_init_lib(NULL); br_init_lib(NULL);
ptr=br_find_exe("spcomp"); ptr=br_find_exe("spcomp");
strlcpy(path,ptr,sizeof path); strlcpy(path,ptr,sizeof path);
free(ptr); free(ptr);
#else #else
if (root!=NULL) if (root!=NULL)
strlcpy(path,root,sizeof path); /* path + filename (hopefully) */ strlcpy(path,root,sizeof path); /* path + filename (hopefully) */
#endif # if defined __MSDOS__
#if defined __MSDOS__
/* strip the options (appended to the path + filename) */ /* strip the options (appended to the path + filename) */
if ((ptr=strpbrk(path," \t/"))!=NULL) if ((ptr=strpbrk(path," \t/"))!=NULL)
*ptr='\0'; *ptr='\0';
#endif # endif
/* terminate just behind last \ or : */ /* terminate just behind last \ or : */
if ((ptr=strrchr(path,DIRSEP_CHAR))!=NULL || (ptr=strchr(path,':'))!=NULL) { if ((ptr=strrchr(path,DIRSEP_CHAR))!=NULL || (ptr=strchr(path,':'))!=NULL) {
/* If there is no "\" or ":", the string probably does not contain the /* If there is no "\" or ":", the string probably does not contain the
@ -1251,18 +1247,18 @@ static void setconfig(char *root)
} /* if */ } /* if */
insert_path(path); insert_path(path);
/* same for the codepage root */ /* same for the codepage root */
#if !defined NO_CODEPAGE # if !defined NO_CODEPAGE
*ptr='\0'; *ptr='\0';
if (!cp_path(path,"codepage")) if (!cp_path(path,"codepage"))
error(169,path); /* codepage path */ error(169,path); /* codepage path */
#endif # endif
/* also copy the root path (for the XML documentation) */ /* also copy the root path (for the XML documentation) */
#if !defined SC_LIGHT # if !defined SC_LIGHT
*ptr='\0'; *ptr='\0';
strcpy(sc_rootpath,path); strcpy(sc_rootpath,path);
#endif # endif
} /* if */ } /* if */
#endif /* macintosh */ #endif /* macintosh */
} }
static void setcaption(void) static void setcaption(void)