forked from emacs-mirror/emacs
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppleMakefile
187 lines (164 loc) · 6.99 KB
/
AppleMakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
## -*-Makefile-*-
# Makefile for emacs
##
App_Dir=$(DSTROOT)/AppleInternal/Applications
Extra_CC_Flags = -Wno-pointer-sign
Extra_LD_Flags = -Wl,-headerpad,0x1000 -Wl,-no_pie
Extra_LD64_Flags = -Wl,-no_function_starts
Extra_Configure_Flags = --without-x --without-carbon ac_cv_host=mac-apple-darwin ac_cv_func_posix_memalign=no
# Project info
Project = emacs
GNUVersion = 22.1
UserType = Developer
ToolType = Commands
CommonNoInstallSource = YES
GnuAfterInstall = remove-dir install-dumpemacs install-dumpemacs-sh cleanup install-plist install-default install-dsyms
GnuNoConfigure = YES
GnuNoBuild = YES
BuildDirectory = .
ConfigStamp = configure-stamp
ifndef MAKEFILEPATH
MAKEFILEPATH = /Developer/Makefiles
endif
ifndef SRCROOT
SRCROOT = .
endif
ifndef SYMROOT
SYMROOT = /tmp/$(Project)/Debug
endif
ifndef OBJROOT
OBJROOT = ./objs
endif
# It is a GNU Source project:
include $(MAKEFILEPATH)/CoreOS/ReleaseControl/GNUSource.make
DSYMUTIL?=dsymutil
RSYNC?=rsync
Environment+= SHELL="$(SRCROOT)"/pipefail.sh
NJOBS=$(shell sysctl -n hw.activecpu)
# Automatic Extract & Patch
AEP_Project = $(Project)
AEP_Version = $(GNUVersion)
AEP_ProjVers = $(AEP_Project)-$(AEP_Version)
AEP_Filename = $(AEP_ProjVers).tar.gz
AEP_ExtractDir = $(AEP_ProjVers)
AEP_Patches = Apple.diff files.el.diff \
CVE-2007-6109.diff darwin.h.diff vcdiff.diff lread.c.diff \
fast-lock.el.diff python.el.diff src_Makefile.in.diff \
lisp_Makefile.in.diff xdisp.c.diff lib-src_update-game-score.c.diff \
src_fileio.c.diff src_search.c.diff lib-src_etags.c.diff \
src_regex.c.diff src_eval.c.25331628.diff
# Extract the source.
install_source::
@if test -e "$(SRCROOT)/$(AEP_Filename)"; then \
$(TAR) --exclude "*.elc" --exclude info -C "$(SRCROOT)" -zxf "$(SRCROOT)/$(AEP_Filename)"; \
$(RMDIR) "$(SRCROOT)/$(AEP_Project)"; \
$(MV) "$(SRCROOT)/$(AEP_ExtractDir)" "$(SRCROOT)/$(AEP_Project)"; \
$(CHMOD) -R go-w "$(SRCROOT)/$(Project)"; \
for patchfile in $(AEP_Patches); do \
cd "$(SRCROOT)/$(Project)" && patch -lp0 -F0 < "$(SRCROOT)/ApplePatches/$$patchfile" || exit 1; \
done; \
$(INSTALL_FILE) "$(SRCROOT)/mac.h" "$(SRCROOT)/$(AEP_Project)/src/m"; \
$(INSTALL_FILE) "$(SRCROOT)/unexmacosx.c" "$(SRCROOT)/$(AEP_Project)/src"; \
for f in $(EXTRAEL); do $(RM) "$(SRCROOT)/$$f"; done; \
else \
$(MAKE) -f AppleMakefile installsrc_old; \
fi
OSV = $(DSTROOT)/usr/local/OpenSourceVersions
OSL = $(DSTROOT)/usr/local/OpenSourceLicenses
EXTRAEL= emacs/lisp/cus-load.el \
emacs/lisp/eshell/esh-groups.el \
emacs/lisp/finder-inf.el \
emacs/lisp/loaddefs.el \
emacs/lisp/mh-e/mh-loaddefs.el \
emacs/lisp/subdirs.el
installsrc_old :
if test ! -d $(SRCROOT); then mkdir -pv $(SRCROOT); fi;
rsync -aC --include '*.ps' --include configure --include Resources --include index.texi ./ $(SRCROOT)/
.PHONY: installsrc_old
remove-dir :
rm $(DSTROOT)/usr/share/info/dir
$(OBJROOT)/bo.h: $(OBJROOT)/src/buildobj.lst
printf "char bo[] = {\n" > $@
hexdump -ve '1/1 "0x%02x,"' < $(OBJROOT)/src/buildobj.lst >> $@
printf "};\n" >> $@
$(OBJROOT)/isemacsvalid.o: $(SRCROOT)/isemacsvalid.c
if test ! -d $(OBJROOT); then mkdir -pv $(OBJROOT); fi
$(CC) -c $(CFLAGS) -o $@ $^
$(OBJROOT)/runit.o: $(SRCROOT)/runit.c
if test ! -d $(OBJROOT); then mkdir -pv $(OBJROOT); fi
$(CC) -c $(CFLAGS) -o $@ $^
$(OBJROOT)/dumpemacs.o: $(OBJROOT)/bo.h $(OBJROOT)/src/version.h
$(CC) -I $(OBJROOT) -DkEmacsVersion=$(patsubst %,'"%"', $(GNUVersion)) $(CFLAGS) -o $@ -g -c $(SRCROOT)/dumpemacs.c
$(SYMROOT)/dumpemacs: $(OBJROOT)/dumpemacs.o $(OBJROOT)/runit.o
if test ! -d $(OBJROOT); then mkdir -pv $(OBJROOT); fi
if test ! -d $(SYMROOT); then mkdir -pv $(SYMROOT); fi
$(CC) $(CFLAGS) -o $@ -g $^
$(OBJROOT)/emacswrapper.o: $(SRCROOT)/emacswrapper.c
if test ! -d $(OBJROOT); then mkdir -pv $(OBJROOT); fi
$(CC) -c $(CFLAGS) -o $@ $^
$(SYMROOT)/emacswrapper: $(OBJROOT)/emacswrapper.o $(OBJROOT)/isemacsvalid.o $(OBJROOT)/runit.o
if test ! -d $(OBJROOT); then mkdir -pv $(OBJROOT); fi
if test ! -d $(SYMROOT); then mkdir -pv $(SYMROOT); fi
$(CC) $(CFLAGS) -o $@ -g $^
install-dumpemacs: $(SYMROOT)/dumpemacs
$(INSTALL) -s -o root -g wheel -m 555 $(SYMROOT)/dumpemacs $(DSTROOT)/usr/libexec/dumpemacs
$(DSYMUTIL) $(SYMROOT)/dumpemacs
$(INSTALL) -s -o root -g wheel -m 555 $(SYMROOT)/emacs $(DSTROOT)/usr/bin/emacs
$(INSTALL) -d "$(DSTROOT)"/usr/share/man/man{1,8}
$(INSTALL) -m 444 -o root -g wheel $(SRCROOT)/dumpemacs.8 "$(DSTROOT)"/usr/share/man/man8
$(INSTALL) -m 444 -o root -g wheel $(SRCROOT)/emacs-undumped.1 "$(DSTROOT)"/usr/share/man/man1
install-dumpemacs-sh: $(SRCROOT)/dumpemacs.sh
$(INSTALL) -o root -g wheel -m 555 $(SRCROOT)/dumpemacs.sh $(DSTROOT)/usr/libexec/
build::
find "$(OBJROOT)" -name Makefile -exec $(SRCROOT)/fixMakefile {} \;
@echo "Bootstraping $(Project)..."
$(MKDIR) $(OBJROOT)/src/arch
ifeq (ppc,$(filter ppc,$(RC_ARCHS)))
$(CC) $(CFLAGS) -c -o $(OBJROOT)/emacs-ppc.o $(SRCROOT)/emacs-ppc.c
$(CC) $(CFLAGS) -o $(OBJROOT)/src/arch/emacs-ppc $(OBJROOT)/emacs-ppc.o
lipo $(OBJROOT)/src/arch/emacs-ppc -extract_family ppc -output $(OBJROOT)/src/arch/emacs-ppc
endif
ruby version.rb emacs > $(OBJROOT)/src/version.h
$(_v) if test ! -e bootstrap-stamp; then \
$(MAKE) -j $(NJOBS) $(Environment) bootstrap; \
date >> bootstrap-stamp; \
else \
$(MAKE) -j $(NJOBS) $(Environment) Makefile; \
./config.status; \
$(MAKE) -j $(NJOBS) $(Environment); \
fi
$(CP) $(OBJROOT)/src/emacs $(SYMROOT) || $(CP) ./src/emacs $(SYMROOT)
$(DSYMUTIL) $(SYMROOT)/emacs # Use current objs
@echo "Change default LoadPath for installed emacs-undumped"
$(MV) $(OBJROOT)/src/lread.o $(OBJROOT)/src/lread.o+save
$(MV) $(OBJROOT)/src/temacs $(OBJROOT)/src/temacs+save
$(RM) $(DSTROOT)/usr/bin/emacs-undumped
$(_v) $(MAKE) -C $(BuildDirectory)/src $(Environment) MYCPPFLAGS=-DEMACS_UNDUMPED temacs
$(INSTALL_FILE) $(OBJROOT)/src/temacs $(OBJROOT)/src/emacs-undumped
$(INSTALL_FILE) $(OBJROOT)/src/emacs-undumped $(SYMROOT)
$(DSYMUTIL) $(SYMROOT)/emacs-undumped
# Do NOT rebuild anything else
$(MV) -f $(OBJROOT)/src/lread.o+save $(OBJROOT)/src/lread.o
$(MV) -f $(OBJROOT)/src/temacs+save $(OBJROOT)/src/temacs
cleanup: # Return sources to pristine state
@echo "Cleaning $(Project)..."
find $(SRCROOT) -type f -name '*.el[c~]' -delete
$(RM) -r $(SRCROOT)/emacs/info
$(RM) "$(DSTROOT)/usr/bin/ctags" "$(DSTROOT)/usr/share/man/man1/ctags.1"
$(RM) "$(DSTROOT)/usr/bin/"{b2m,ebrowse,grep-changelog,rcs-checkin}
$(RM) -r "$(DSTROOT)/usr/var"
for f in $(EXTRAEL); do $(RM) -f "$(SRCROOT)/$$f"; done
install-plist:
$(INSTALL) -d $(OSV)
$(INSTALL_FILE) $(SRCROOT)/$(Project).plist $(OSV)/$(Project).plist
$(INSTALL) -d $(OSL)
$(INSTALL_FILE) $(Sources)/COPYING $(OSL)/$(Project).txt
install-default:
$(INSTALL) -o root -g wheel -m 644 default.el "$(DSTROOT)"/usr/share/emacs/site-lisp
$(INSTALL) -o root -g wheel -m 644 site-start.el "$(DSTROOT)"/usr/share/emacs/site-lisp
install-dsyms:
for f in emacsclient etags cvtmail digest-doc fakemail hexl movemail profile sorted-doc update-game-score; do \
$(RSYNC) -ia $(OBJROOT)/lib-src/$$f $(SYMROOT)/; \
$(DSYMUTIL) $(SYMROOT)/$$f; \
done
# EOF