comparison binary-dist-rules.mk @ 3431:a7c772aa106f

Move mk-dist script functionality into Makefile. * mk-dist: Delete. * binary-dist-rules.mk: New file. * Makefile.in: Include binary-dist-rules.mk. (STRIP_DIST_FILES, STABLE_BUILD, DATE): New variables. * configure.ac: New option --disable-strip-dist-files. * makeinst-script.sh: Require output file as second argument.
author John W. Eaton <jwe@octave.org>
date Thu, 16 Jan 2014 18:03:14 -0500
parents
children 5fc3d674ca3a
comparison
equal deleted inserted replaced
3430:2183ac663bcb 3431:a7c772aa106f
1
2 ifeq ($(STABLE_BUILD),yes)
3 OCTAVE_TARGET := stable-octave
4 OCTAVE_DIST_NAME := octave-$($(OCTAVE_TARGET)_VERSION)
5 else
6 OCTAVE_TARGET := octave
7 OCTAVE_DIST_NAME := octave-$(DATE)
8 endif
9
10 OCTAVE_DIST_DIR := $(TOP_DIR)/dist/$(OCTAVE_DIST_NAME)
11
12 OCTAVE_NSI_FILE := $(TOP_DIR)/dist/octave.nsi
13
14 ## FIXME: We need a way to ask "is this a windows build?"
15 ifeq ($(MXE_SYSTEM), mingw)
16 WINDOWS_BINARY_DIST_DEPS := msys-base npp
17 endif
18 ifeq ($(MXE_SYSTEM), msvc)
19 WINDOWS_BINARY_DIST_DEPS := msys-base npp
20 endif
21
22 BINARY_DIST_DEPS := \
23 $(OCTAVE_TARGET) \
24 native-gcc \
25 native-binutils \
26 octave-forge-packages \
27 units \
28 transfig \
29 $(WINDOWS_BINARY_DIST_FILES)
30
31 define delete-dist-directory
32 echo "deleting previous dist directory..."
33 rm -rf $(TOP_DIR)/dist
34 endef
35
36 define make-dist-directory
37 echo "creating dist directory..."
38 mkdir -p $(TOP_DIR)/dist/octave-$(DATE)
39 endef
40
41 define make-stable-dist-directory
42 echo "creating dist directory..."
43 mkdir -p $(OCTAVE_DIST_DIR)
44 endef
45
46 define generate-dist-exclude-list
47 echo "generating lists of files to exclude..."
48 echo " native files..."
49 echo "./$(TARGET)" > $(TOP_DIR)/excluded-native-files
50 echo "./bin/$(TARGET)-*.exe" >> $(TOP_DIR)/excluded-native-files
51 echo " gcc cross compiler files..."
52 cd $(TOP_DIR)/cross-tools/$(HOST_PREFIX) \
53 && find . -type f -o -type l | sed "s,./,," > $(TOP_DIR)/excluded-gcc-files
54 endef
55
56 define copy-dist-files
57 echo "copying files..."
58 echo " octave and dependencies..."
59 cd $(HOST_PREFIX) \
60 && tar -c -h -X $(TOP_DIR)/excluded-gcc-files -f - . | ( cd $(OCTAVE_DIST_DIR) ; tar xpf - )
61 echo " octaverc file..."
62 cp $(TOP_DIR)/build_packages.m $(OCTAVE_DIST_DIR)/src \
63 && cp $(TOP_DIR)/octaverc $(OCTAVE_DIST_DIR)/share/octave/site/m/startup/octaverc
64 echo " native tools..."
65 cd $(TOP_DIR)/native-tools/usr \
66 && tar -c -h -X $(TOP_DIR)/excluded-native-files -f - . | ( cd $(OCTAVE_DIST_DIR) ; tar xpf - )
67 echo " libgcc_s_dw2-1.dll to bin directory"
68 cd $(OCTAVE_DIST_DIR) \
69 && cp lib/gcc/i686-pc-mingw32/libgcc_s_dw2-1.dll bin
70 echo " msys base files..."
71 cd $(TOP_DIR)/msys-base \
72 && tar -c -h -f - . | ( cd $(OCTAVE_DIST_DIR) ; tar xpf - )
73 echo " msys extension files..."
74 cd $(TOP_DIR)/msys-extension \
75 && tar -c -h -f - . | ( cd $(OCTAVE_DIST_DIR) ; tar xpf - )
76 echo " notepad++..."
77 cd $(TOP_DIR) \
78 && tar -c -h -f - notepad++ | ( cd $(OCTAVE_DIST_DIR) ; tar xpf - )
79 echo " build_packages.m..."
80 cp $(TOP_DIR)/build_packages.m $(OCTAVE_DIST_DIR)/src
81 endef
82
83 define make-dist-files-writable
84 echo "making all dist files writable by user..."
85 chmod -R u+w $(OCTAVE_DIST_DIR)
86 endef
87
88 ifeq ($(STRIP_DIST_FILES),yes)
89 define strip-dist-files
90 echo "stripping files..."
91 for f in $$(find $(OCTAVE_DIST_DIR) -name '*.dll' -o -name '*.exe'); do \
92 $(MXE_STRIP) $$f; \
93 done
94 endef
95 else
96 define strip-dist-files
97 echo "not stripping files..."
98 endef
99 endif
100
101 .PHONY: binary-dist-files
102 binary-dist-files: $(BINARY_DIST_DEPS)
103 @$(delete-dist-directory)
104 @$(make-dist-directory)
105 @$(generate-dist-exclude-list)
106 @$(copy-dist-files)
107 @$(make-dist-files-writable)
108 @$(strip-dist-files)
109
110 define make-installer-file
111 echo "generating installer script..."
112 ./makeinst-script.sh $(OCTAVE_DIST_DIR) $(OCTAVE_NSI_FILE)
113 echo "generating installer..."
114 $(TARGET)-makensis $(OCTAVE_NSI_FILE) > $(TOP_DIR)/dist/nsis.log
115 echo "deleting installer script..."
116 rm -f $(OCTAVE_NSI_FILE)
117 endef
118
119 $(OCTAVE_DIST_NAME)-installer.exe: nsis binary-dist-files
120 @$(make-installer-file)
121
122 .PHONY: nsis-installer
123 nsis-installer: $(OCTAVE_DIST_NAME)-installer.exe
124
125 define make-zip-dist
126 echo "generating zip file..."
127 cd $(TOP_DIR)/dist \
128 && zip -q -9 -r $(OCTAVE_DIST_NAME).zip $(OCTAVE_DIST_NAME)
129 endef
130
131 .PHONY: zip-dist
132 zip-dist: binary-dist-files
133 @$(make-zip-dist)
134
135 define make-tar-dist
136 echo "generating tar file..."
137 cd $(TOP_DIR)/dist \
138 && tar -c -z -f $(OCTAVE_DIST_NAME).zip $(OCTAVE_DIST_NAME)
139 endef
140
141 .PHONY: tar-dist
142 tar-dist: binary-dist-files
143 @$(make-tar-dist)