fixed the symlink install tool
parent
2ae23f5c7e
commit
4c3a7ce03c
|
@ -119,7 +119,6 @@ elif sys.platform == 'darwin':
|
||||||
if hasPython:
|
if hasPython:
|
||||||
fixOSXPluginPath('libpython/mitsuba.dylib')
|
fixOSXPluginPath('libpython/mitsuba.dylib')
|
||||||
installAs(os.path.join(distDir, 'python/mitsuba.so'), 'libpython/mitsuba.dylib')
|
installAs(os.path.join(distDir, 'python/mitsuba.so'), 'libpython/mitsuba.dylib')
|
||||||
env.Install(os.path.join(distDir, 'data'), ['#data/darwin/install-symlinks.sh'])
|
|
||||||
install(frameworkDir, [
|
install(frameworkDir, [
|
||||||
'GLEW.framework/Resources/libs/libGLEW.dylib', 'OpenEXR.framework/Resources/lib/libHalf.6.dylib',
|
'GLEW.framework/Resources/libs/libGLEW.dylib', 'OpenEXR.framework/Resources/lib/libHalf.6.dylib',
|
||||||
'OpenEXR.framework/Resources/lib/libIex.6.dylib', 'OpenEXR.framework/Resources/lib/libImath.6.dylib',
|
'OpenEXR.framework/Resources/lib/libIex.6.dylib', 'OpenEXR.framework/Resources/lib/libImath.6.dylib',
|
||||||
|
@ -133,6 +132,7 @@ elif sys.platform == 'darwin':
|
||||||
'Collada14Dom.framework/Resources/lib/libCollada14Dom.dylib'], '#dependencies/darwin')
|
'Collada14Dom.framework/Resources/lib/libCollada14Dom.dylib'], '#dependencies/darwin')
|
||||||
if hasQt:
|
if hasQt:
|
||||||
install(os.path.join(distDir, 'Contents/MacOS'), ['mtsgui/mtsgui'])
|
install(os.path.join(distDir, 'Contents/MacOS'), ['mtsgui/mtsgui'])
|
||||||
|
install(os.path.join(distDir, 'Contents/MacOS'), ['mtsgui/symlinks_install'])
|
||||||
installTargets += env.OSXLibInst(frameworkDir, '/Library/Frameworks/QtCore.framework/Versions/4/QtCore')
|
installTargets += env.OSXLibInst(frameworkDir, '/Library/Frameworks/QtCore.framework/Versions/4/QtCore')
|
||||||
opengl = env.OSXLibInst(frameworkDir, '/Library/Frameworks/QtOpenGL.framework/Versions/4/QtOpenGL')
|
opengl = env.OSXLibInst(frameworkDir, '/Library/Frameworks/QtOpenGL.framework/Versions/4/QtOpenGL')
|
||||||
xml = env.OSXLibInst(frameworkDir, '/Library/Frameworks/QtXml.framework/Versions/4/QtXml')
|
xml = env.OSXLibInst(frameworkDir, '/Library/Frameworks/QtXml.framework/Versions/4/QtXml')
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
APP=`pwd`
|
|
||||||
PY_DSO=/Library/Python/2.6/site-packages/mitsuba.so
|
|
||||||
|
|
||||||
install() {
|
|
||||||
echo $APP/Contents/MacOS/$1 \$@ > /usr/bin/$1
|
|
||||||
chmod +x /usr/bin/$1
|
|
||||||
}
|
|
||||||
fix_import() {
|
|
||||||
install_name_tool -change @loader_path/../Contents/Frameworks/$1.dylib $APP/Contents/Frameworks/$1.dylib $PY_DSO
|
|
||||||
}
|
|
||||||
|
|
||||||
install mitsuba
|
|
||||||
install mtsgui
|
|
||||||
install mtssrv
|
|
||||||
install mtsimport
|
|
||||||
install mtsutil
|
|
||||||
|
|
||||||
if [ -e $APP/python/mitsuba.so ]
|
|
||||||
then
|
|
||||||
cp $APP/python/mitsuba.so $PY_DSO
|
|
||||||
fix_import libboost_python
|
|
||||||
fix_import libboost_system
|
|
||||||
fix_import libboost_filesystem
|
|
||||||
fix_import libmitsuba-core
|
|
||||||
fix_import libmitsuba-render
|
|
||||||
fix_import libmitsuba-hw
|
|
||||||
fix_import libmitsuba-bidir
|
|
||||||
fix_import libiomp5
|
|
||||||
fi
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ if hasQt:
|
||||||
qtEnv_osx.ConfigureForObjectiveCPP()
|
qtEnv_osx.ConfigureForObjectiveCPP()
|
||||||
qtEnv_osx['CXXFLAGS'].append(['-Fdependencies/darwin', '-framework', 'BWToolkitFramework'])
|
qtEnv_osx['CXXFLAGS'].append(['-Fdependencies/darwin', '-framework', 'BWToolkitFramework'])
|
||||||
qtSources += qtEnv_osx.StaticObject('previewsettingsdlg_cocoa_impl.mm')
|
qtSources += qtEnv_osx.StaticObject('previewsettingsdlg_cocoa_impl.mm')
|
||||||
|
env.Program('symlinks_install', ['symlinks_install.c'])
|
||||||
else:
|
else:
|
||||||
qtSources = [x for x in qtSources if (not isinstance(x, str) or 'cocoa' not in x)]
|
qtSources = [x for x in qtSources if (not isinstance(x, str) or 'cocoa' not in x)]
|
||||||
mtsgui = qtEnv.Program('mtsgui', qtSources)
|
mtsgui = qtEnv.Program('mtsgui', qtSources)
|
||||||
|
|
|
@ -466,7 +466,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionEnableCommandLine">
|
<action name="actionEnableCommandLine">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable command line access</string>
|
<string>Command-line Access</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -13,9 +13,8 @@ bool create_symlinks() {
|
||||||
AuthorizationRef ref;
|
AuthorizationRef ref;
|
||||||
|
|
||||||
OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, flags, &ref);
|
OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, flags, &ref);
|
||||||
if (status != errAuthorizationSuccess) {
|
if (status != errAuthorizationSuccess)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
AuthorizationItem items = {kAuthorizationRightExecute, 0, NULL, 0};
|
AuthorizationItem items = {kAuthorizationRightExecute, 0, NULL, 0};
|
||||||
AuthorizationRights rights = { 1, &items };
|
AuthorizationRights rights = { 1, &items };
|
||||||
|
@ -28,12 +27,12 @@ bool create_symlinks() {
|
||||||
AuthorizationFree(ref, kAuthorizationFlagDefaults);
|
AuthorizationFree(ref, kAuthorizationFlagDefaults);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char *path = "/usr/bin/sudo";
|
std::string bundlePath = mitsuba::__ubi_bundlepath();
|
||||||
std::string scriptPath = mitsuba::__ubi_bundlepath() + "/data/install-symlinks.sh";
|
std::string path = bundlePath + "/Contents/MacOS/symlinks_install";
|
||||||
char *args[] = { "bash", const_cast<char *>(scriptPath.c_str()), NULL };
|
char *args[] = { const_cast<char *>(bundlePath.c_str()), NULL };
|
||||||
FILE *pipe = pipe = NULL;
|
FILE *pipe = NULL;
|
||||||
flags = kAuthorizationFlagDefaults;
|
flags = kAuthorizationFlagDefaults;
|
||||||
status = AuthorizationExecuteWithPrivileges(ref, path, flags, args, &pipe);
|
status = AuthorizationExecuteWithPrivileges(ref, const_cast<char *>(path.c_str()), flags, args, &pipe);
|
||||||
if (status != errAuthorizationSuccess) {
|
if (status != errAuthorizationSuccess) {
|
||||||
AuthorizationFree(ref, kAuthorizationFlagDefaults);
|
AuthorizationFree(ref, kAuthorizationFlagDefaults);
|
||||||
return false;
|
return false;
|
|
@ -0,0 +1,72 @@
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
|
||||||
|
void installPython(const char *basedir) {
|
||||||
|
const char *fname = "/Library/Python/2.6/site-packages/mitsuba.pth";
|
||||||
|
|
||||||
|
FILE *f = fopen(fname, "w");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "Unable to write to file \"%s\"!\n", fname);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fprintf(f, "import sys; sys.path.append(\"%s/python\")\n", basedir) < 1) {
|
||||||
|
fprintf(stderr, "Unexpected I/O error while "
|
||||||
|
"writing to \"%s\"!\n", fname);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void install(const char *basedir, const char *name) {
|
||||||
|
char fname[MAXPATHLEN];
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
snprintf(fname, sizeof(fname), "/usr/bin/%s", name);
|
||||||
|
|
||||||
|
f = fopen(fname, "w");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "Unable to write to file \"%s\"!\n", fname);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fprintf(f, "%s/Contents/MacOS/%s $@\n", basedir, name) < 1) {
|
||||||
|
fprintf(stderr, "Unexpected I/O error while "
|
||||||
|
"writing to \"%s\"!\n", fname);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
if (chmod(fname, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
|
||||||
|
fprintf(stderr, "Unexpected I/O error while setting "
|
||||||
|
"the permssions of \"%s\"!\n", fname);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if (argc != 2) {
|
||||||
|
fprintf(stderr, "Incorrect number of arguments!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setuid(0) != 0) {
|
||||||
|
fprintf(stderr, "setuid(): failed!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
install(argv[1], "mitsuba");
|
||||||
|
install(argv[1], "mtsgui");
|
||||||
|
install(argv[1], "mtssrv");
|
||||||
|
install(argv[1], "mtsutil");
|
||||||
|
install(argv[1], "mtsimport");
|
||||||
|
installPython(argv[1]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue