Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MacOS compile process #12

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions 544_update.patch

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions MacOS.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ diff -c -r ./src/VisDrawer.cpp ../p4vasp-0.3.31/src/VisDrawer.cpp
#include <p4vasp/Exceptions.h>
#include <stdio.h>
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>

const char *VisDrawer::getClassName(){return "VisDrawer";}

Expand All @@ -35,7 +35,7 @@ diff -c -r ./src/VisIsosurfaceDrawer.cpp ../p4vasp-0.3.31/src/VisIsosurfaceDrawe
#include <p4vasp/VisIsosurfaceDrawer.h>
#include <math.h>
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>
#include <stdio.h>
#include <string.h>
#include <p4vasp/vecutils.h>
Expand All @@ -55,7 +55,7 @@ diff -c -r ./src/VisMain.cpp ../p4vasp-0.3.31/src/VisMain.cpp
#include <FL/Fl.H>
#include <FL/Fl_Gl_Window.H>
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>
#include <p4vasp/VisFLWindow.h>

THREAD(Vis_thread);
Expand All @@ -75,7 +75,7 @@ diff -c -r ./src/VisNavDrawer.cpp ../p4vasp-0.3.31/src/VisNavDrawer.cpp
#include <p4vasp/VisNavDrawer.h>
#include <FL/Fl.H>
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>
#include <p4vasp/vecutils.h>
#include <p4vasp/Exceptions.h>

Expand All @@ -95,7 +95,7 @@ diff -c -r ./src/VisPrimitiveDrawer.cpp ../p4vasp-0.3.31/src/VisPrimitiveDrawer.
#include <p4vasp/VisPrimitiveDrawer.h>
#include <math.h>
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>
#include <stdio.h>
#include <p4vasp/Exceptions.h>

Expand All @@ -115,7 +115,7 @@ diff -c -r ./src/VisStructureArrowsDrawer.cpp ../p4vasp-0.3.31/src/VisStructureA
#include <p4vasp/VisStructureArrowsDrawer.h>
#include <math.h>
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>
#include <stdio.h>
#include <string.h>
#include <p4vasp/vecutils.h>
Expand All @@ -135,7 +135,7 @@ diff -c -r ./src/VisStructureDrawer.cpp ../p4vasp-0.3.31/src/VisStructureDrawer.
#include <p4vasp/VisStructureDrawer.h>
#include <math.h>
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>
#include <stdio.h>
#include <p4vasp/vecutils.h>
#include <p4vasp/VisBackEvent.h>
Expand Down Expand Up @@ -183,7 +183,7 @@ diff -c -r ./src/include/p4vasp/VisFLWindow.h ../p4vasp-0.3.31/src/include/p4vas

#include <FL/Fl_Gl_Window.H>
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>
#include "VisWindow.h"

class VisFLWindow : public Fl_Gl_Window{
Expand All @@ -203,7 +203,7 @@ diff -c -r ./src/include/p4vasp/VisIsosurfaceDrawer.h ../p4vasp-0.3.31/src/inclu
#include "Chgcar.h"
#include "threads.h"
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>

#ifndef VisWindow
class VisWindow;
Expand All @@ -223,7 +223,7 @@ diff -c -r ./src/include/p4vasp/VisPrimitiveDrawer.h ../p4vasp-0.3.31/src/includ
#include "VisDrawer.h"
#include "threads.h"
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>

#ifndef VisWindow
class VisWindow;
Expand All @@ -243,7 +243,7 @@ diff -c -r ./src/include/p4vasp/VisStructureArrowsDrawer.h ../p4vasp-0.3.31/src/
#include "VisStructureDrawer.h"
#include "threads.h"
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>

#ifndef VisWindow
class VisWindow;
Expand All @@ -263,7 +263,7 @@ diff -c -r ./src/include/p4vasp/VisStructureDrawer.h ../p4vasp-0.3.31/src/includ
#include "VisPrimitiveDrawer.h"
#include "threads.h"
#include <FL/gl.h>
! #include <openGL/glu.h>
! #include <OpenGL/glu.h>
#include "AtomInfo.h"
#include "Structure.h"

8 changes: 4 additions & 4 deletions Makefile.MacOS
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ P4V = p4v

all: p4vasp
local:
cd install && python configure.py local
cd install && python2 configure.py local
config:
cd install && python configure.py
cd install && python2 configure.py
p4vasp: p4vasp_config uninstallsh appletlist
cd odpdom && $(MAKE) libODP.a
cd src && $(MAKE)
Expand All @@ -67,9 +67,9 @@ launcher:
echo "#export APPMENU_DISPLAY_BOTH=1" >>$(P4V)
echo "export UBUNTU_MENUPROXY=0" >>$(P4V)
echo "export P4VASP_HOME="$(P4VASP_HOME) >> $(P4V)
echo "exec python "$(BINDIR)"/p4v.py \"\$$@\"" >>$(P4V)
echo "exec python2 "$(BINDIR)"/p4v.py \"\$$@\"" >>$(P4V)
appletlist:
cd install && python makeappletlist.py
cd install && python2 makeappletlist.py
bashrc:setenvironment
echo "" >> ~/.bashrc
cat $(SETENVIRONMENT) >> ~/.bashrc
Expand Down
1 change: 0 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,3 @@ odpdom/COPYING).
This package as well may contain other packages (in ext directory) under various open-source licenses:
fltk (www.fltk.org), sqlite (www.sqlite.org) and pysqlite (code.google.com/p/pysqlite).
These packages are provided for convenience only to make the installation easier.

28 changes: 25 additions & 3 deletions README.MacOS
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
p4vasp compillation in MacOS:
(Tested on Mac OS 10.13.4, all updates installed.)
(Tested on Mac OS 10.14.4 by Chengcheng-Xiao, all updates installed. )
(Contact me by E-mail : iconxicon@me.com )
( or Github : https://github.com/orest-d/p4vasp/issues/ )


0) You will need X11 and the command-line tools for Xcode installed.
For Xquratz, visit: https://www.xquartz.org/
For command-line tools: $ xcode-select --install
To install header file: install /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg by double click.


1) For FLTK installation, we use homebrew's fltk:
Install homebrew: $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
update homebrew: $ brew update
Install fltk: $ brew install fltk

2) Install other necessary library: $ brew install python@2 pip gcc gtk+ pygtk —with-libglade && pip install pyopengl numpy

2) Install other necessary library: $ brew install python@2
$ pip install pyopengl numpy
$ brew install gcc@7
$ brew install gtk+
$ brew install --build-from-source ./pygtk.rb —-with-libglade

(*)Note that homebrew team are deleting all formula options to avoid compilation.
(*)In one merged pull request (#35732) they deleted the libglade support.
(*)Please use the provided formula file pygtk.rb to install pygtk.


3) Apply patch to the sourcefile: $ patch -p0 -i MacOS.patch


5) Copy the Makefile.MacOS to Makefile in the p4vasp root directory and in the src
directory:
$ cp Makefile.MacOS Makefile
$ cp odpdom/Makefile.MacOS odpdom/Makefile
$ cp src/Makefile.MacOS src/Makefile


6) Run make and install:
make local && make && make install

7) The executable should located at ~/p4vasp/bin

7) The executable should located at ~/p4vasp/bin
you can put it in your PATH by:
$ export PATH=~/p4vasp/bin:$PATH

Known bugs:
(1). Close window directly can causes froze-window. FIX: Uses exit option under Files.
(2). Buttons can be unresponsive sometimes. FIX: try wait a while.....
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ Installation (MacOS)
$ brew install fltk
```

3) Install other necessary library:
3) Install other necessary library:
```
$ brew install python@2 pip gcc gtk+ pygtk —with-libglade && pip install pyopengl numpy
```
4) Apply patch to the sourcefile:
4) Apply patch to the sourcefile:
```
$ patch -p0 -i MacOS.patch
```
Expand All @@ -134,7 +134,14 @@ Installation (MacOS)
7) The executable should located at `~/p4vasp/bin`



VASP (version 5.4.4+) update
--------------------------
In VASP version 5.4.4, the projection label `dx2` for dx2-y2 orbital changed to `x2-y2`.
(0) Apply patch to the source files:
```
$ patch -p0 -i 544_update.patch
```
Note: This fix is not backward compatible.

Starting:
--------------------------
Expand All @@ -160,5 +167,3 @@ odpdom/COPYING).
This package as well may contain other packages (in ext directory) under various open-source licenses:
[fltk](www.fltk.org), [sqlite](www.sqlite.org) and [pysqlite](code.google.com/p/pysqlite).
These packages are provided for convenience only to make the installation easier.


2 changes: 1 addition & 1 deletion odpdom/Makefile.MacOS
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ FLAGS = -DPY_DOMEXC_MODULE="\"xml.dom.\""
# -DNO_POS_CACHE
# -DNO_THROW

PYINCLUDE=`python -c "import sys;import os.path;print os.path.join(sys.prefix,\"include\",\"python\"+sys.version[:3])"`
PYINCLUDE=`python2 -c "import sys;import os.path;print os.path.join(sys.prefix,\"include\",\"python\"+sys.version[:3])"`
CFLAGS += -fpic -g $(FLAGS) -I$(PYINCLUDE) -Iinclude

SWIGFLAGS = -python -c++ $(FLAGS)
Expand Down
41 changes: 41 additions & 0 deletions pygtk.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
class Pygtk < Formula
desc "GTK+ bindings for Python"
homepage "http://www.pygtk.org/"
url "https://download.gnome.org/sources/pygtk/2.24/pygtk-2.24.0.tar.bz2"
sha256 "cd1c1ea265bd63ff669e92a2d3c2a88eb26bcd9e5363e0f82c896e649f206912"
revision 2

bottle do
cellar :any
sha256 "6aa04785bcbf9c1e79a268b27263ce61dbfa64cb21023c426b70ead3b6671689" => :mojave
sha256 "228a919cbba58afc99747e9b5dc6d01013ef8463de2ede5d81c20103afccbb9f" => :high_sierra
sha256 "fce76d2bf1e1748ac110aede98a622e5f8b737390a3a5e22f56872834b73c033" => :sierra
sha256 "fd1cef5484267e02971c4daa1eda42e3a66c77786923b0f76b496007282b10a1" => :el_capitan
end

depends_on "pkg-config" => :build
depends_on "atk"
depends_on "glib"
depends_on "gtk+"
depends_on "py2cairo"
depends_on "pygobject"
depends_on "libglade" => :optional

def install
ENV.append "CFLAGS", "-ObjC"
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make", "install"

# Fixing the pkgconfig file to find codegen, because it was moved from
# pygtk to pygobject. But our pkgfiles point into the cellar and in the
# pygtk-cellar there is no pygobject.
inreplace lib/"pkgconfig/pygtk-2.0.pc", "codegendir=${datadir}/pygobject/2.0/codegen", "codegendir=#{HOMEBREW_PREFIX}/share/pygobject/2.0/codegen"
inreplace bin/"pygtk-codegen-2.0", "exec_prefix=${prefix}", "exec_prefix=#{Formula["pygobject"].opt_prefix}"
end

test do
(testpath/"codegen.def").write("(define-enum asdf)")
system "#{bin}/pygtk-codegen-2.0", "codegen.def"
end
end