Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 89 lines (84 sloc) 6.484 kb
fc709cac » ripley
2009-02-24 separate framework-specific stuff to a separate makefile
1 #-*- Makefile -*-
2 #
3 # ${R_HOME}/Makefile.fw
4
5 top_builddir = .
6
7 include $(top_builddir)/Makeconf
8
9 install install-strip: install-R-framework
10 @(sed 's|^LIBR =.*|LIBR = -F$(R_FRAMEWORK_DIR)/.. -framework R|' \
11 $(top_builddir)/etc/Makeconf > "$(rhome)/etc${R_ARCH}/Makeconf")
12 @(sed 's/Versions\/$(FW_VERSION)\/Resources/Resources/' \
13 $(R_FRAMEWORK_DIR)/Resources/bin/R > \
14 $(R_FRAMEWORK_DIR)/Resources/bin/RR)
15 @(mv $(R_FRAMEWORK_DIR)/Resources/bin/RR $(R_FRAMEWORK_DIR)/Resources/bin/R)
16 @(chmod a+x $(R_FRAMEWORK_DIR)/Resources/bin/R)
17 @(chmod -R g+w $(R_FRAMEWORK_DIR))
18
19
20 install-R-framework:
21 @$(ECHO) "Creating R framework ..."
22 @(cd "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)" && \
23 ln -f -s -n Resources/include Headers && \
24 ln -f -s -n Resources/lib/libR.dylib R)
25 @if [ ! -e "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/PrivateHeaders" ]; then \
26 mkdir "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/PrivateHeaders"; fi
27 @(cd "$(R_FRAMEWORK_DIR)/Versions" && \
28 ln -f -s -n $(FW_VERSION) Current)
29 @(cd "$(R_FRAMEWORK_DIR)" && \
30 ln -f -s -n Versions/Current/PrivateHeaders PrivateHeaders&& \
31 ln -f -s -n Versions/Current/Headers Headers&& \
32 ln -f -s -n Versions/Current/R R && \
33 ln -f -s -n Versions/Current/Resources/lib Libraries && \
34 ln -f -s -n Versions/Current/Resources Resources)
35 @## the resulting libR will point dyld to the fat libR regardless of its origin
36 @(cd "$(R_FRAMEWORK_DIR)/Resources/lib" && \
37 install_name_tool -id "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/libR.dylib" $(Rexeclibdir)/libR.dylib)
38 @( otool=otool ; if otool -D "$(Rexeclibdir)/libR.dylib"|grep 'not an object'>/dev/null; then otool=otool64; fi; \
39 for lib in Rlapack Rblas R; do \
40 if test -e "$(Rexeclibdir)/lib$${lib}.dylib"; then $(ECHO) " lib$${lib}"; \
41 find "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/" -name '*.so' -or -name '*.dylib' | \
42 xargs -n 1 install_name_tool -change \
43 `$${otool} -L $(Rexeclibdir)/lib$${lib}.dylib |sed -n -e '2 s/.\(.*\) (compat.*/\1/p'` \
44 "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/lib$${lib}.dylib" ; \
45 find "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/" -name '*.so' -or -name '*.dylib' | \
46 xargs -n 1 install_name_tool -change lib$${lib}.dylib \
47 "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/lib$${lib}.dylib" ; \
48 install_name_tool -id "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/lib$${lib}.dylib" \
49 "$(Rexeclibdir)/lib$${lib}.dylib"; \
50 if [ "$(Rexeclibdir)" != "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib" ]; then \
51 $(top_srcdir)/tools/updatefat "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/lib$${lib}.dylib" "$(Rexeclibdir)/lib$${lib}.dylib"; \
52 install_name_tool -id "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/lib$${lib}.dylib" \
53 "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/lib$${lib}.dylib"; \
54 fi; \
55 for rexe in `ls "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)"/Resources/bin/exec/*/R "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/bin/exec/R" 2>/dev/null`; do \
56 install_name_tool -change lib$${lib}.dylib \
57 "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/lib$${lib}.dylib" "$$rexe" ; \
58 done; \
59 fi; \
60 done)
61 @(cp -R $(top_srcdir)/src/include/* $(R_FRAMEWORK_DIR)/Versions/Current/PrivateHeaders/ && \
62 cp src/include/config.h $(R_FRAMEWORK_DIR)/Versions/Current/PrivateHeaders/ && \
63 chmod a+r $(R_FRAMEWORK_DIR)/Versions/Current/PrivateHeaders/config.h; \
64 find $(R_FRAMEWORK_DIR)/Versions/Current/PrivateHeaders -name .svn | xargs rm -rf)
65 @(install_name_tool -change libR.dylib \
66 "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/libR.dylib" \
67 $(Rexecbindir2)/R)
68 @(if [ -n "${R_ARCH}" ]; then \
69 rm -rf $(R_FRAMEWORK_DIR)/Versions/Current/PrivateHeaders${R_ARCH} && \
70 mkdir $(R_FRAMEWORK_DIR)/Versions/Current/PrivateHeaders${R_ARCH} && \
71 cp src/include/config.h $(R_FRAMEWORK_DIR)/Versions/Current/PrivateHeaders${R_ARCH}/config.h; \
72 chmod a+r $(R_FRAMEWORK_DIR)/Versions/Current/PrivateHeaders${R_ARCH}/config.h; \
73 sed -e "s|R_ARCH=${R_ARCH}|R_ARCH=/\`arch\`|" "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/bin/R" \
74 > "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/bin/.tmp.R" && \
75 chmod a+x "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/bin/.tmp.R" && \
76 mv "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/bin/.tmp.R" "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/bin/R"; \
77 if [ "${R_ARCH}" != /ppc -a "${R_ARCH}" != /i386 -a "${R_ARCH}" != /ppc64 -a "${R_ARCH}" != /x86_64 -a "${R_ARCH}" != /arm ]; then \
78 $(ECHO) "\
79 *** WARNING: The architecture name is incompatible with Apple's naming~ convention. This may prevent applications from using the R~ framework. Please use i386, x86_64, ppc, ppc64 or arm as architecture~ names to allow universal builds."|sed 'y/~/\n/' >&2; \
80 else \
81 for f in `ls "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Headers/${R_ARCH}/"*.h|xargs basename` config.h; do \
82 fn="Headers/$$f"; if [ "$$f" = "config.h" ]; then fn="PrivateHeaders/config.h"; fi; \
83 $(ECHO) "/* This is an automatically generated universal stub for architecture-dependent headers. */~#ifdef __i386__~#include \"i386/$$f\"~#elif defined __ppc__~#include \"ppc/$$f\"~#elif defined __ppc64__~#include \"ppc64/$$f\"~#elif defined __x86_64__~#include \"x86_64/$$f\"~#elif defined __arm__~#include \"arm/$$f\"~#else~#error \"Unsupported architecture.\"~#endif" |sed -e 'y/~/\n/' > "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/$$fn"; \
84 done; \
85 fi; \
86 fi )
87 @( rm -f "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/R" && \
88 ln -s bin/R "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/R" )
89 @( $(ECHO) "<?xml version=\"1.0\" encoding=\"UTF-8\"?>~<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">~<plist version=\"1.0\">~<dict>~ <key>CFBundleIdentifier</key>~ <string>org.r-project.R-framework</string>~ <key>CFBundleInfoDictionaryVersion</key>~ <string>6.0</string>~ <key>CFBundleName</key>~ <string>R</string>~ <key>CFBundlePackageType</key>~ <string>FMWK</string>~ <key>CFBundleVersion</key>~ <string>$(VERSION)</string>~</dict>~</plist>" |sed -e 'y/~/\n/' > $(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/Info.plist)
Something went wrong with that request. Please try again.