aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Pierre Boutillier <pierre.boutillier@ens-lyon.org>2014-07-21 15:50:20 +0200
committerGravatar Pierre Boutillier <pierre.boutillier@ens-lyon.org>2014-07-22 17:13:32 +0200
commita088d03434417e935df3c75f81a954eadbdfc2b8 (patch)
treedcd5a5d4372236a46838106a13f3bf9a9e071dd2
parent4271bebb68b09ddcc0d283ab16acaab399e22f13 (diff)
A makefile rule to build bin/CoqIDE_$VERSION.app macOS bundle
The created bundle contains only coqide and gtk (no coqtop, no stdlib)
-rw-r--r--Makefile1
-rw-r--r--Makefile.build91
-rw-r--r--Makefile.common11
-rw-r--r--ide/MacOS/Info.plist.template87
-rw-r--r--ide/MacOS/coqfile.icnsbin0 -> 50724 bytes
-rw-r--r--ide/MacOS/coqide.icnsbin0 -> 38372 bytes
-rw-r--r--ide/MacOS/default_accel_map (renamed from ide/mac_default_accel_map)0
-rwxr-xr-xide/MacOS/relatify_with-respect-to_.sh15
8 files changed, 203 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 17cfec046..31b36c792 100644
--- a/Makefile
+++ b/Makefile
@@ -224,6 +224,7 @@ clean-ide:
rm -f ide/input_method_lexer.ml
rm -f ide/highlight.ml ide/config_lexer.ml ide/config_parser.mli ide/config_parser.ml
rm -f ide/utf8_convert.ml
+ rm -rf $(COQIDEAPP)
ml4clean:
rm -f $(GENML4FILES)
diff --git a/Makefile.build b/Makefile.build
index 1a16dd6ee..dd1c30a23 100644
--- a/Makefile.build
+++ b/Makefile.build
@@ -297,7 +297,7 @@ COQIDEFLAGS=$(addprefix -I , $(IDESRCDIRS)) $(COQIDEINCLUDES) -thread
.SUFFIXES:.vo
-IDEFILES=$(wildcard ide/coq*.lang) ide/coq_style.xml ide/coq.png ide/mac_default_accel_map
+IDEFILES=$(wildcard ide/coq*.lang) ide/coq_style.xml ide/coq.png ide/MacOS/default_accel_map
coqide-binaries: coqide-$(HASCOQIDE)
coqide-no:
@@ -350,7 +350,7 @@ ifeq ($(BEST),opt)
$(INSTALLSH) $(FULLCOQLIB) $(IDECMA:.cma=.cmxa) $(IDECMA:.cma=.a)
endif
-install-ide-files:
+install-ide-files: #Please update $(COQIDEAPP)/Contents/Resources/ at the same time
$(MKDIR) $(FULLDATADIR)
$(INSTALLLIB) ide/coq.png ide/coq.lang ide/coq_style.xml $(FULLDATADIR)
$(MKDIR) $(FULLCONFIGDIR)
@@ -361,6 +361,93 @@ install-ide-info:
$(INSTALLLIB) ide/FAQ $(FULLDOCDIR)/FAQ-CoqIde
###########################################################################
+# CoqIde MacOS special targets
+###########################################################################
+
+.PHONY: $(COQIDEAPP)/Contents
+
+$(COQIDEAPP)/Contents:
+ rm -rdf $@
+ $(MKDIR) $@
+ sed -e "s/VERSION/$(VERSION)/g" ide/MacOS/Info.plist.template > $@/Info.plist
+ $(MKDIR) "$@/MacOS"
+
+$(COQIDEINAPP): ide/macos_prehook.cmx $(LINKIDEOPT) | $(COQIDEAPP)/Contents
+ $(SHOW)'OCAMLOPT -o $@'
+ $(HIDE)$(OCAMLOPT) $(COQIDEFLAGS) $(OPTFLAGS) -o $@ \
+ unix.cmxa lablgtk.cmxa lablgtksourceview2.cmxa str.cmxa \
+ $(IDEFLAGS:.cma=.cmxa) $^
+ $(STRIP) $@
+
+$(COQIDEAPP)/Contents/Resources/share: $(COQIDEAPP)/Contents
+ $(MKDIR) $@/coq/
+ $(INSTALLLIB) ide/coq.png ide/coq.lang ide/coq_style.xml $@/coq/
+ $(MKDIR) $@/gtksourceview-2.0/{language-specs,styles}
+ $(INSTALLLIB) "$(GTKSHARE)/"gtksourceview-2.0/language-specs/{def.lang,language2.rng} $@/gtksourceview-2.0/language-specs/
+ $(INSTALLLIB) "$(GTKSHARE)/"gtksourceview-2.0/styles/{styles.rng,classic.xml} $@/gtksourceview-2.0/styles/
+ cp -R "$(GTKSHARE)/"locale $@
+ cp -R "$(GTKSHARE)/"icons $@
+ cp -R "$(GTKSHARE)/"themes $@
+
+$(COQIDEAPP)/Contents/Resources/loaders: $(COQIDEAPP)/Contents
+ $(MKDIR) $@
+ $(INSTALLLIB) $$("$(GTKBIN)/gdk-pixbuf-query-loaders" | sed -n -e '5 s!.*= \(.*\)$$!\1!p')/libpixbufloader-png.so $@
+
+$(COQIDEAPP)/Contents/Resources/immodules: $(COQIDEAPP)/Contents
+ $(MKDIR) $@
+ $(INSTALLLIB) "$(GTKLIBS)/gtk-2.0/2.10.0/immodules/"*.so $@
+
+
+$(COQIDEAPP)/Contents/Resources/etc: $(COQIDEAPP)/Contents/Resources/lib
+ $(MKDIR) $@/xdg/coq
+ $(INSTALLLIB) ide/MacOS/default_accel_map $@/xdg/coq/coqide.keys
+ $(MKDIR) $@/gtk-2.0
+ { "$(GTKBIN)/gdk-pixbuf-query-loaders" $@/../loaders/*.so |\
+ sed -e "s!/.*\(/loaders/.*.so\)!@executable_path/../Resources/\1!"; } \
+ > $@/gtk-2.0/gdk-pixbuf.loaders
+ { "$(GTKBIN)/gtk-query-immodules-2.0" $@/../immodules/*.so |\
+ sed -e "s!/.*\(/immodules/.*.so\)!@executable_path/../Resources/\1!" |\
+ sed -e "s!/.*\(/share/locale\)!@executable_path/../Resources/\1!"; } \
+ > $@/gtk-2.0/gtk-immodules.loaders
+ $(MKDIR) $@/pango
+ echo "[Pango]" > $@/pango/pangorc
+
+$(COQIDEAPP)/Contents/Resources/lib: $(COQIDEAPP)/Contents/Resources/immodules $(COQIDEAPP)/Contents/Resources/loaders $(COQIDEAPP)/Contents $(COQIDEINAPP)
+ $(MKDIR) $@
+ $(INSTALLLIB) $(GTKLIBS)/charset.alias $@/
+ $(MKDIR) $@/pango/1.8.0/modules
+ $(INSTALLLIB) "$(GTKLIBS)/pango/1.8.0/modules/"*.so $@/pango/1.8.0/modules/
+ { "$(GTKBIN)/pango-querymodules" $@/pango/1.8.0/modules/*.so |\
+ sed -e "s!/.*\(/pango/1.8.0/modules/.*.so\)!@executable_path/../Resources/lib\1!"; } \
+ > $@/pango/1.8.0/modules.cache
+
+ for i in $$(otool -L $(COQIDEINAPP) |sed -n -e "\@$(GTKLIBS)@ s/[^/]*\(\/[^ ]*\) .*$$/\1/p"); \
+ do cp $$i $@/; \
+ ide/MacOS/relatify_with-respect-to_.sh $@/$$(basename $$i) $(GTKLIBS) $@; \
+ done
+ for i in $@/../loaders/*.so $@/../immodules/*.so $@/pango/1.8.0/modules/*.so; \
+ do \
+ for j in $$(otool -L $$i | sed -n -e "\@$(GTKLIBS)@ s/[^/]*\(\/[^ ]*\) .*$$/\1/p"); \
+ do cp $$j $@/; ide/MacOS/relatify_with-respect-to_.sh $@/$$(basename $$j) $(GTKLIBS) $@; done; \
+ ide/MacOS/relatify_with-respect-to_.sh $$i $(GTKLIBS) $@; \
+ done
+ EXTRAWORK=1; \
+ while [ $${EXTRAWORK} -eq 1 ]; \
+ do EXTRAWORK=0; \
+ for i in $@/*.dylib; \
+ do for j in $$(otool -L $$i | sed -n -e "\@$(GTKLIBS)@ s/[^/]*\(\/[^ ]*\) .*$$/\1/p"); \
+ do EXTRAWORK=1; cp $$j $@/; ide/MacOS/relatify_with-respect-to_.sh $@/$$(basename $$j) $(GTKLIBS) $@; done; \
+ done; \
+ done
+ ide/MacOS/relatify_with-respect-to_.sh $(COQIDEINAPP) $(GTKLIBS) $@
+
+$(COQIDEAPP)/Contents/Resources:$(COQIDEAPP)/Contents/Resources/etc $(COQIDEAPP)/Contents/Resources/share
+ $(INSTALLLIB) ide/MacOS/*.icns $@
+
+$(COQIDEAPP):$(COQIDEAPP)/Contents/Resources
+ codesign -s - $@
+
+###########################################################################
# tests
###########################################################################
diff --git a/Makefile.common b/Makefile.common
index 8a70273ad..4bc203197 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -43,6 +43,8 @@ MKDIR:=install -d
COQIDEBYTE:=bin/coqide.byte$(EXE)
COQIDE:=bin/coqide$(EXE)
+COQIDEAPP:=bin/CoqIDE_$(VERSION).app
+COQIDEINAPP:=$(COQIDEAPP)/Contents/MacOS/coqide
ifeq ($(BEST),opt)
OPT:=opt
@@ -362,6 +364,15 @@ DOCMLIS=$(wildcard ./lib/*.mli ./intf/*.mli ./kernel/*.mli ./library/*.mli \
DOT=dot
ODOCDOTOPTS=-dot -dot-reduce
+###########################################################################
+# GTK for Coqide MacOS bundle
+###########################################################################
+
+GTKSHARE=$(shell pkg-config --variable=prefix gtk+-2.0)/share
+GTKBIN=$(shell pkg-config --variable=prefix gtk+-2.0)/bin
+GTKLIBS=$(shell pkg-config --variable=libdir gtk+-2.0)
+
+
# For emacs:
# Local Variables:
# mode: makefile
diff --git a/ide/MacOS/Info.plist.template b/ide/MacOS/Info.plist.template
new file mode 100644
index 000000000..cba708e94
--- /dev/null
+++ b/ide/MacOS/Info.plist.template
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>*</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>NSStringPboardType</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>****</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeIconFile</key>
+ <string>coqfile.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Coq file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>text/plain</string>
+ </array>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>v</string>
+ </array>
+ <key>LSHandlerRank</key>
+ <string>Owner</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeName</key>
+ <string>All</string>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>text/plain</string>
+ </array>
+ <key>LSHandlerRank</key>
+ <string>Default</string>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>*</string>
+ </array>
+ </dict>
+ </array>
+ <key>CFBundleIconFile</key>
+ <string>coqide.icns</string>
+ <key>CFBundleVersion</key>
+ <string>390</string>
+ <key>CFBundleName</key>
+ <string>CoqIDE</string>
+ <key>CFBundleShortVersionString</key>
+ <string>Coq_vVERSION</string>
+ <key>CFBundleDisplayName</key>
+ <string>Coq Proof Assistant vVERSION</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Coq_vVERSION</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright 1999-2014, The Coq Development Team INRIA - CNRS - LIX - LRI - PPS</string>
+ <key>CFBundleHelpBookFolder</key>
+ <string>share/doc/coq/html/</string>
+ <key>CFAppleHelpAnchor</key>
+ <string>index</string>
+ <key>CFBundleExecutable</key>
+ <string>coqide</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleIdentifier</key>
+ <string>fr.inria.coqide</string>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
diff --git a/ide/MacOS/coqfile.icns b/ide/MacOS/coqfile.icns
new file mode 100644
index 000000000..1946f3d61
--- /dev/null
+++ b/ide/MacOS/coqfile.icns
Binary files differ
diff --git a/ide/MacOS/coqide.icns b/ide/MacOS/coqide.icns
new file mode 100644
index 000000000..2252bb4b6
--- /dev/null
+++ b/ide/MacOS/coqide.icns
Binary files differ
diff --git a/ide/mac_default_accel_map b/ide/MacOS/default_accel_map
index 6f474eb12..6f474eb12 100644
--- a/ide/mac_default_accel_map
+++ b/ide/MacOS/default_accel_map
diff --git a/ide/MacOS/relatify_with-respect-to_.sh b/ide/MacOS/relatify_with-respect-to_.sh
new file mode 100755
index 000000000..a24af9395
--- /dev/null
+++ b/ide/MacOS/relatify_with-respect-to_.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+for i in "$3/"*.dylib
+do install_name_tool -change "$2"/$(basename $i) @executable_path/../Resources/lib/$(basename $i) "$1"
+done
+case "$1" in
+ *.dylib)
+ install_name_tool -id @executable_path/../Resources/lib/$(basename $1) $1
+ for i in "$3"/*.dylib
+ do install_name_tool -change "$2/"$(basename $1) @executable_path/../Resources/lib/$(basename $1) $i
+ done;;
+ *)
+esac