Ticket #17419: Portfile

File Portfile, 3.6 KB (added by adfernandes (Andrew Fernandes), 15 years ago)

initial portfile

Line 
1# $Id: $
2
3PortSystem                  1.0
4
5name                        pymol
6version                     1.1
7revision            1
8categories                  science
9maintainers                 andrew@fernandes.org
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/svnroot/pymol/branches/b11/pymol
20worksrcdir      pymol
21
22depends_lib     port:glut port:freetype port:libpng port:python25 port:py25-tkinter port:py25-pmw
23
24set pyversion       2.5
25set python_bin      "${prefix}/bin/python${pyversion}"
26
27configure.args              --with-x --with-glu
28configure.python            "${python_bin}"
29configure.cflags-append     "-I${x11prefix}/include"
30configure.ldflags-append    "-L${x11prefix}/lib"
31
32variant gcc43 description {build using macports-gcc-4.3} {
33    depends_build-append    port:gcc43
34    configure.compiler      macports-gcc-4.3
35}
36
37destroot {
38
39    set libdir "${destroot}${prefix}/lib/pymol"
40
41    xinstall -m 755 -d "${libdir}/lib"
42
43    set libs { lib_glu_nummodule lib_glumodule lib_glutmodule lib_opengl_nummodule lib_openglmodule libchamp libopenglutil libopenglutil_num libpymol }
44
45    foreach lib $libs {
46        xinstall -m 644 "${worksrcpath}/.libs/${lib}.lai"         "${libdir}/lib"
47        xinstall -m 755 "${worksrcpath}/.libs/${lib}.0.0.0.dylib" "${libdir}/lib"
48        system "cd ${libdir}/lib ; ln -s ${lib}.lai ${lib}.la ; ln -s ${lib}.0.0.0.dylib ${lib}.0.dylib ; ln -s ${lib}.0.0.0.dylib ${lib}.dylib"
49        set dylib "${prefix}/lib/pymol/lib/${lib}.0.0.0.dylib"
50        system "install_name_tool -id ${dylib} ${destroot}${dylib}"
51        # Note: for PyMOL-1.1, each library is independent, so we don't need to "install_name_tool -change ... ..." them!
52    }
53
54    foreach dir { modules scripts } {
55        system "cp -r ${worksrcpath}/${dir} ${libdir}"
56        system "chown -R root:admin ${libdir}/${dir}"
57        system "find ${libdir}/${dir} -type f -exec chmod 644 {} \\;"
58        system "find ${libdir}/${dir} -type d -exec chmod 755 {} \\;"
59        system "find ${libdir}/${dir} -name .svn -print0 | xargs -0 rm -rf"
60    }
61
62    system "cd ${libdir}/modules/pymol             ; ln -s ../../lib/libpymol.0.0.0.dylib _cmd.so"
63    system "cd ${libdir}/modules/chempy/champ      ; ln -s ../../../lib/libchamp.0.0.0.dylib _champ.so"
64    system "cd ${libdir}/modules/pymol/opengl/gl   ; ln -s ../../../../lib/libopenglutil.0.0.0.dylib openglutil.so"
65    system "cd ${libdir}/modules/pymol/opengl/gl   ; ln -s ../../../../lib/libopenglutil_num.0.0.0.dylib openglutil_num.so"
66    system "cd ${libdir}/modules/pymol/opengl/gl   ; ln -s ../../../../lib/lib_openglmodule.0.0.0.dylib _openglmodule.so"
67    system "cd ${libdir}/modules/pymol/opengl/gl   ; ln -s ../../../../lib/lib_opengl_nummodule.0.0.0.dylib _opengl_nummodule.so"
68    system "cd ${libdir}/modules/pymol/opengl/glu  ; ln -s ../../../../lib/lib_glumodule.0.0.0.dylib _glumodule.so"
69    system "cd ${libdir}/modules/pymol/opengl/glu  ; ln -s ../../../../lib/lib_glu_nummodule.0.0.0.dylib _glu_nummodule.so"
70    system "cd ${libdir}/modules/pymol/opengl/glut ; ln -s ../../../../lib/lib_glutmodule.0.0.0.dylib _glutmodule.so"
71
72    set exe "${destroot}${prefix}/bin/pymol"
73    set file [open "${exe}" "w" 0755]
74    puts ${file} "#!/bin/bash"
75    puts ${file} "export PYMOL_PATH=\"${prefix}/lib/pymol\""
76    puts ${file} "exec \"${python_bin}\" \"\$PYMOL_PATH/modules/launch_pymol.py\" \"\$@\""
77    close ${file}
78    system "chown root:admin ${exe}"
79
80}