-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·154 lines (129 loc) · 5.06 KB
/
configure
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
#!/bin/sh
# Copyright (C) 2023 Philippe Aubertin.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of other contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ZLIB=userspace/lib/zlib
BZIP2=userspace/lib/bzip2
CFLAGS="-std=c99 -ffreestanding -I../../../include"
ARCH="-m32"
echo "Configuring zlib in $ZLIB"
if [ ! -f "$ZLIB/zlib.h" ]; then
echo ""
echo "*** ERROR: zlib.h not found in $ZLIB."
echo "*** "
echo "*** Did you forget to initialize the git submodules when you cloned the repository? "
echo "*** If so, you can clone and initialize them now with the following command:"
echo "***"
echo "*** git submodule update --init"
echo "***"
echo "*** See README.md for detail."
exit 1
fi
echo "*** Please ignore any warning about vsnprintf() not being found in stdio.h."
echo "*** Jinue does not use the part of the code in zlib where that warning is relevant."
(cd $ZLIB; CFLAGS="$CFLAGS" ./configure --solo --static --warn --const --archs="$ARCH")
echo "Configuring bzip2 in $ZLIB"
if [ ! -f "$BZIP2/bzlib.h" ]; then
echo ""
echo "*** ERROR: bzlib.h not found in $BZIP2."
echo "*** "
echo "*** Did you forget to initialize the git submodules when you cloned the repository? "
echo "*** If so, you can clone and initialize them now with the following command:"
echo "***"
echo "*** git submodule update --init"
echo "***"
echo "*** See README.md for detail."
exit 1
fi
echo "*** If you re-run this configuration script after having already run it once, you will"
echo "*** see warning messages similar to the following which you can safely ignore:"
echo "***"
echo "*** Reversed (or previously applied) patch detected! Skipping patch."
echo "*** 5 out of 5 hunks ignored"
echo "***"
# There is no configure script for bzip2 but the CFLAGS are hardcoded in the
# Makefile, so let's patch them there. Let's also remove code related to
# compression to reduce size and the number of compiler warnings.
(cd $BZIP2 ; (cat << "EOF") | sed -e "s@%%%-CFLAGS-%%%@$CFLAGS $ARCH@" | patch -Np1 -r-
diff --git a/Makefile b/Makefile
index b0fef95..4987a38 100644
--- a/Makefile
+++ b/Makefile
@@ -21,17 +21,15 @@ RANLIB=ranlib
LDFLAGS=
BIGFILES=-D_FILE_OFFSET_BITS=64
-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
+CFLAGS=%%%-CFLAGS-%%% -Wall -Winline -O2 -g $(BIGFILES) -DBZ_NO_STDIO
# Where you want it installed when you do 'make install'
PREFIX=/usr/local
-OBJS= blocksort.o \
- huffman.o \
+OBJS= huffman.o \
crctable.o \
randtable.o \
- compress.o \
decompress.o \
bzlib.o
diff --git a/bzlib.c b/bzlib.c
index 100873c..2a9bc33 100644
--- a/bzlib.c
+++ b/bzlib.c
@@ -113,6 +113,7 @@ void default_bzfree ( void* opaque, void* addr )
/*---------------------------------------------------*/
+#if 0
static
void prepare_new_block ( EState* s )
{
@@ -144,6 +145,7 @@ Bool isempty_RL ( EState* s )
}
+
/*---------------------------------------------------*/
int BZ_API(BZ2_bzCompressInit)
( bz_stream* strm,
@@ -482,6 +484,7 @@ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm )
return BZ_OK;
}
+#endif
/*---------------------------------------------------*/
@@ -1244,6 +1247,7 @@ void BZ_API(BZ2_bzReadGetUnused)
/*---------------------------------------------------*/
/*---------------------------------------------------*/
+#if 0
int BZ_API(BZ2_bzBuffToBuffCompress)
( char* dest,
unsigned int* destLen,
@@ -1293,7 +1297,7 @@ int BZ_API(BZ2_bzBuffToBuffCompress)
BZ2_bzCompressEnd ( &strm );
return ret;
}
-
+#endif
/*---------------------------------------------------*/
int BZ_API(BZ2_bzBuffToBuffDecompress)
EOF
)