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
|
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
+
+
-
-
+
+
-
+
+
-
-
-
+
+
+
+
+
+
-
-
+
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
-
|
DOWNLOAD_CMD ?= wget
UNZIP ?= bsdtar
MINGW_BINDIR ?= C:\\\\MinGW\\\\bin # Used for InnoSetup script
# This is more to help me remember all the steps than for building :)
# In fact right now this does *not* work as a Makefile. Sorry!
define BSDTAR
mkdir -p $(DEST_DIR) && bsdtar -x -C$(DEST_DIR) -f $^
endef
define SEVENZIP
7z x -o$(DEST_DIR) $^
endef
define REAL_UNZIP
unzip -d$(DEST_DIR) $^
endef
ifeq ($(UNZIP), bsdtar)
UNZIP_CMD = $(BSDTAR)
else ifeq ($(UNZIP), 7z)
UNZIP_CMD = $(SEVENZIP)
else ifeq ($(UNZIP), unzip)
UNZIP_CMD = $(REAL_UNZIP)
endif
CSC_OPTIONS=-IC:/mylibs/iup/include -LC:/mylibs/iup
PREFIX ?= c:/chicken-iup
NATIVE_PREFIX = $(subst /,\\\\,$(PREFIX)) # Used for InnoSetup script
CHICKEN_URL = http://code.call-cc.org/releases
ifndef CHICKEN_VERSION
CHICKEN_VERSION = 4.9.0
CHICKEN_PATCHLEVEL = .1
endif
CHICKEN_PKGNAME = chicken-$(CHICKEN_VERSION)$(CHICKEN_PATCHLEVEL)
CHICKEN_DIR = $(CHICKEN_PKGNAME)
CHICKEN_PKG = $(CHICKEN_PKGNAME).tar.gz
CHICKEN_PLATFORM ?= mingw-msys
CHICKEN_PREFIX ?= $(PREFIX)
eh :
@echo "Read the make file eh."
EGGS = apropos trace regex-case regex-literals format big-chicken pdf sql-de-lite coops tinyclos test regex slime canvas-draw utf8
define GET_FFCALL_CVS
cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/libffcall co ffcall
endef
define GET_FFCALL_PKG
wget http://www.haible.de/bruno/gnu/$(FFCALL_PKG)
tar zxvf $(FFCALL_PKG)
endef
FFCALL_VERSION ?= cvs
FFCALL_PREFIX ?= $(PREFIX)
ifeq ($(FFCALL_VERSION), cvs)
FFCALL_DIR = ffcall
FFCALL_PKG =
GET_FFCALL = $(GET_FFCALL_CVS)
else
FFCALL_DIR = ffcall-$(FFCALL_VERSION)
FFCALL_PKG = ffcall-$(FFCALL_VERSION).tar.gz
GET_FFCALL = $(GET_FFCALL_PKG)
endif
IUP_URL = http://sourceforge.net/projects
IUP_PLATFORM ?= Win32_dllw4
IUP_LIBDIR ?= $(PREFIX)/lib
IM_LONGNAME = imtoolkit
IM_VERSION ?= 3.9
IM_PKG = im-$(IM_VERSION)_$(IUP_PLATFORM)_lib.zip
CD_LONGNAME = canvasdraw
CD_VERSION ?= 5.8.1
CD_PKG = cd-$(CD_VERSION)_$(IUP_PLATFORM)_lib.zip
IUP_LONGNAME = iup
IUP_VERSION ?= 3.13
IUP_PKG = iup-$(IUP_VERSION)_$(IUP_PLATFORM)_lib.zip
SRC_PKGS = $(CHICKEN_PKG) $(FFCALL_PKG)
BIN_PKGS = $(IM_PKG) $(CD_PKG) $(IUP_PKG)
SRC_DIRS = $(CHICKEN_DIR) $(FFCALL_DIR)
.PHONY : all pkgs.prep srcpkgs.get binpkgs.get srcpkgs.verify binpkgs.verify srcpkgs.extract chicken.compile binpkgs.install iup_all.install im.install cd.install iup.install srcpkgs.compile install base.install binpkg.prep strip-lua eggs clean distclean lzma-kludge
all : install binpkg.prep
pkgs.prep : srcpkgs.extract binpkgs.verify
srcpkgs.get : $(CHICKEN_PKG)
$(CHICKEN_PKG) :
$(DOWNLOAD_CMD) $(CHICKEN_URL)/$(CHICKEN_VERSION)/$(CHICKEN_PKG)
# tar zxvf $(CHICKEN_PKG)
binpkgs.get : $(IM_PKG) $(CD_PKG) $(IUP_PKG)
$(IM_PKG) :
$(DOWNLOAD_CMD) $(IUP_URL)/$(IM_LONGNAME)/files/$(IM_VERSION)/Windows%20Libraries/Dynamic/$(IM_PKG)
$(CD_PKG) :
$(DOWNLOAD_CMD) $(IUP_URL)/$(CD_LONGNAME)/files/$(CD_VERSION)/Windows%20Libraries/Dynamic/$(CD_PKG)
$(IUP_PKG) :
$(DOWNLOAD_CMD) $(IUP_URL)/$(IUP_LONGNAME)/files/$(IUP_VERSION)/Windows%20Libraries/Dynamic/$(IUP_PKG)
srcpkgs.verify : srcpkgs.get
chicken-4.6.5
cd c:/mylibs/src/chicken-4.6.5
$(MAKE) PLATFORM=mingw PREFIX=c:/chicken
chicken.verify : $(CHICKEN_PKG)
ffcall.verify :
binpkgs.verify : binpkgs.get
srcpkgs.extract : srcpkgs.verify $(CHICKEN_DIR) $(FFCALL_DIR)
$(CHICKEN_DIR) : chicken.verify
tar zxvf $(CHICKEN_PKG)
touch $(CHICKEN_DIR)
$(FFCALL_DIR) :
$(GET_FFCALL)
touch $(FFCALL_DIR)
binpkgs.install : binpkgs.verify iup_all.install
iup_all.install : lzma-kludge im.install cd.install iup.install
im.install : DEST_DIR = $(IUP_LIBDIR)
im.install : $(IM_PKG)
$(UNZIP_CMD)
cd.install : DEST_DIR = $(IUP_LIBDIR)
cd.install : $(CD_PKG)
$(UNZIP_CMD)
iup.install : DEST_DIR = $(IUP_LIBDIR)
iup.install : $(IUP_PKG)
$(UNZIP_CMD)
lzma-kludge :
if [ "${UNZIP}" = "bsdtar" ]; then \
cd /bin && \
if [ ! -f msys-lzma-1.dll ]; then \
ln -s msys-lzma-5.dll msys-lzma-1.dll; \
fi \
fi
srcpkgs.compile : chicken.compile ffcall.compile
chicken.compile : $(CHICKEN_DIR) $(CHICKEN_DIR)/chicken.h.orig
cd $(CHICKEN_DIR) && \
$(MAKE) PLATFORM=$(CHICKEN_PLATFORM) PREFIX=$(CHICKEN_PREFIX)
$(CHICKEN_DIR)/chicken.h.orig : $(CHICKEN_DIR)
cd $(CHICKEN_DIR) && \
patch -p0 <../0001-Disable-getc_unlocked.patch
iup-module :
chicken-install -D no-library-checks iup
ffcall.compile : $(FFCALL_DIR)
cd $(FFCALL_DIR) && \
./configure --prefix=$(FFCALL_PREFIX) && \
$(MAKE)
base.install : srcpkgs.compile chicken.install ffcall.install binpkgs.install
# chicken.install : chicken.compile
chicken.install :
cd $(CHICKEN_DIR) && \
$(MAKE) PLATFORM=$(CHICKEN_PLATFORM) PREFIX=$(CHICKEN_PREFIX) install
canvas-draw-module :
chicken-install -D no-library-checks canvas-draw
ffcall.install :
cd $(FFCALL_DIR) && \
$(MAKE) install
install : base.install eggs
eggs :
apropos trace regex-case regex-literals format big-chicken pdf sql-de-lite coops tinyclos test regex slime
chicken-install -D disable-iup-web iup
$(foreach egg,$(EGGS),chicken-install -keep-installed $(egg);)
sqlite3 :
set CSC_OPTIONS=-IC:/chicken/include -LC:/chicken
# CAREFUL: this rule removes the entire $PREFIX directory tree!
binpkg.prep : chicken-iup.iss strip-lua
sqlite3
mkdir -p binpkg && \
mv $(PREFIX)/* binpkg && rmdir $(PREFIX)
examples-inst :
mkdir -p c:/chicken/examples
cp examples/*.scm c:/chicken/examples
chicken-iup.iss : chicken-iup.iss.in
sed "s#{%CIUPPrefix%}#$(strip $(NATIVE_PREFIX))#g" $< \
| sed "s#{%ChickenVersion%}#$(strip $(CHICKEN_VERSION)$(CHICKEN_PATCHLEVEL))#g" \
| sed "s#{%MinGWBindir%}#$(strip $(MINGW_BINDIR))#g" > $@
strip-lua :
rm -f $(IUP_LIBDIR)/*lua* $(IUP_LIBDIR)/include/*lua*
setup-chicken-iup.exe : Output/setup.exe
cp Output/setup.exe setup-chicken-iup.exe
clean : chicken.clean ffcall.clean
all : iup-module canvas-draw-module examples-inst # setup-chicken-iup.exe
chicken.clean :
cd $(CHICKEN_DIR) && \
$(MAKE) PLATFORM=$(CHICKEN_PLATFORM) clean
iup :
cd iup;CSC_OPTIONS='-IC:/programs/chicken/include -LC:/programs/chicken/lib' chicken-install -D no-library-checks iup
ffcall.clean :
cd $(FFCALL_DIR) && \
$(MAKE) clean
distclean :
# rm -rf $(SRC_PKGS) $(BIN_PKGS) $(SRC_DIRS) binpkg Output chicken-iup.iss
# Matt W requested installer in repo, so Output is omitted
rm -rf $(SRC_PKGS) $(BIN_PKGS) $(SRC_DIRS) binpkg chicken-iup.iss
CSC_OPTIONS='-IC:/programs/chicken/lib/include -LC:/programs/chicken/lib' chicken-install -D no-library-checks -D disable-iup-web
|