Ticket #17419: Portfile.2

File Portfile.2, 3.5 KB (added by adfernandes (Andrew Fernandes), 15 years ago)

pymol 1.2r2 - almost

Line 
1# $Id: $
2
3PortSystem                  1.0
4
5name                        pymol
6version                     1.2r2
7svn.revision        3866
8categories                  science
9maintainers                 adfernandes@macports.org  openmaintainer
10description             A Popular X11-based Molecular Visualization System
11long_description    PyMOL is a user-sponsored, X11-based molecular visualization system that uses python.
12
13platforms               darwin
14
15homepage            http://www.pymol.org/
16
17master_sites        sourceforge
18fetch.type          svn
19svn.url             https://pymol.svn.sourceforge.net:443/svnroot/pymol/trunk/pymol
20worksrcdir          pymol
21depends_lib         port:glut port:freetype port:libpng port:python26 port:py26-tkinter port:py26-pmw
22
23set pyversion       2.6
24set python_bin      "${prefix}/bin/python${pyversion}"
25
26configure.args      --with-x --x-include=${prefix}/include --x-lib=${prefix}/lib --with-glu
27configure.python    "${python_bin}"
28
29variant gcc43 description {build using macports-gcc-4.3} {
30    depends_build-append        port:gcc43
31    configure.compiler          macports-gcc-4.3
32    configure.ldflags-append    "-L${prefix}/lib/gcc43" "-lstdc++"
33}
34
35destroot {
36
37    set libdir "${destroot}${prefix}/lib/pymol"
38
39    xinstall -m 755 -d "${libdir}/lib"
40
41    set libs { lib_glu_nummodule lib_glumodule lib_glutmodule lib_opengl_nummodule lib_openglmodule libchamp libopenglutil libopenglutil_num libpymol }
42
43    foreach lib $libs {
44        xinstall -m 644 "${worksrcpath}/.libs/${lib}.lai"     "${libdir}/lib"
45        xinstall -m 755 "${worksrcpath}/.libs/${lib}.0.dylib" "${libdir}/lib"
46        system "cd ${libdir}/lib ; ln -s ${lib}.lai ${lib}.la ; ln -s ${lib}.0.dylib ${lib}.dylib"
47        set dylib "${prefix}/lib/pymol/lib/${lib}.0.dylib"
48        system "install_name_tool -id ${dylib} ${destroot}${dylib}"
49        # Note: Currently, each library is independent, so we don't need to "install_name_tool -change ... ..." them!
50    }
51
52    foreach dir { modules scripts } {
53        system "cp -r ${worksrcpath}/${dir} ${libdir}"
54        system "chown -R root:admin ${libdir}/${dir}"
55        system "find ${libdir}/${dir} -type f -exec chmod 644 {} \\;"
56        system "find ${libdir}/${dir} -type d -exec chmod 755 {} \\;"
57        system "find ${libdir}/${dir} -name .svn -print0 | xargs -0 rm -rf"
58    }
59
60    system "cd ${libdir}/modules/pymol             ; ln -s ../../lib/libpymol.0.dylib _cmd.so"
61    system "cd ${libdir}/modules/chempy/champ      ; ln -s ../../../lib/libchamp.0.dylib _champ.so"
62    system "cd ${libdir}/modules/pymol/opengl/gl   ; ln -s ../../../../lib/libopenglutil.0.dylib openglutil.so"
63    system "cd ${libdir}/modules/pymol/opengl/gl   ; ln -s ../../../../lib/libopenglutil_num.0.dylib openglutil_num.so"
64    system "cd ${libdir}/modules/pymol/opengl/gl   ; ln -s ../../../../lib/lib_openglmodule.0.dylib _openglmodule.so"
65    system "cd ${libdir}/modules/pymol/opengl/gl   ; ln -s ../../../../lib/lib_opengl_nummodule.0.dylib _opengl_nummodule.so"
66    system "cd ${libdir}/modules/pymol/opengl/glu  ; ln -s ../../../../lib/lib_glumodule.0.dylib _glumodule.so"
67    system "cd ${libdir}/modules/pymol/opengl/glu  ; ln -s ../../../../lib/lib_glu_nummodule.0.dylib _glu_nummodule.so"
68    system "cd ${libdir}/modules/pymol/opengl/glut ; ln -s ../../../../lib/lib_glutmodule.0.dylib _glutmodule.so"
69
70    set exe "${destroot}${prefix}/bin/pymol"
71    set file [open "${exe}" "w" 0755]
72    puts ${file} "#!/bin/bash"
73    puts ${file} "export PYMOL_PATH=\"${prefix}/lib/pymol\""
74    puts ${file} "exec \"${python_bin}\" \"\$PYMOL_PATH/modules/launch_pymol.py\" \"\$@\""
75    close ${file}
76    system "chown root:admin ${exe}"
77
78}