baf27b2d2459bb1ca6a2aeea7be9cf6dcf6409e1
[openwrt/svn-archive/archive.git] / libs / xyssl / patches / 001-cross_compile.patch
1 diff -ruN xyssl-0.7-old/library/Makefile xyssl-0.7-new/library/Makefile
2 --- xyssl-0.7-old/library/Makefile 2007-07-07 07:07:00.000000000 +0200
3 +++ xyssl-0.7-new/library/Makefile 2007-08-29 12:20:53.000000000 +0200
4 @@ -9,10 +9,13 @@
5 # _BSD_EXTENSION when compiling on Plan9
6
7 DEFINES = -DSELF_TEST -DHAVE_RDTSC
8 -CFLAGS = $(DEFINES) -I../include -O
9 +CFLAGS = $(DEFINES) -I../include
10 +OFLAGS = -O
11 +
12 +AR ?= ar
13
14 # To compile as a shared library:
15 -# CFLAGS += -fPIC
16 +CFLAGS += -fPIC
17
18 # MicroBlaze specific options:
19 # CFLAGS += -mno-xl-soft-mul -mxl-barrel-shift
20 @@ -25,21 +28,21 @@
21
22 .SILENT:
23
24 -all: libxyssl.a
25 +all: libxyssl.a libxyssl.so
26
27 libxyssl.a: $(OBJS)
28 echo " AR $@"
29 - ar r $@ $(OBJS)
30 + $(AR) r $@ $(OBJS)
31
32 shared: libxyssl.so
33
34 libxyssl.so: libxyssl.a
35 echo " LD $@"
36 - gcc -shared -Wl,-soname,$@ -o $@ $(OBJS)
37 + $(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS)
38
39 .c.o:
40 echo " CC $<"
41 - $(CC) $(CFLAGS) -c $<
42 + $(CC) $(CFLAGS) $(OFLAGS) -c $<
43
44 clean:
45 rm -f *.o libxyssl.*
46 diff -ruN xyssl-0.7-old/programs/Makefile xyssl-0.7-new/programs/Makefile
47 --- xyssl-0.7-old/programs/Makefile 2007-07-07 07:07:00.000000000 +0200
48 +++ xyssl-0.7-new/programs/Makefile 2007-08-29 12:19:25.000000000 +0200
49 @@ -2,7 +2,8 @@
50 # To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS
51 # To compile on MinGW: add "-lws2_32" to LDFLAGS
52
53 -CFLAGS = -I../include -O
54 +CFLAGS = -I../include
55 +OFLAGS = -O
56 LDFLAGS = -L../library -lxyssl
57
58 APPS = aes/aescrypt2 hash/hello \
59 @@ -21,71 +22,71 @@
60
61 aes/aescrypt2: aes/aescrypt2.c ../library/libxyssl.a
62 echo " CC aes/aescrypt2.c"
63 - $(CC) $(CFLAGS) aes/aescrypt2.c $(LDFLAGS) -o $@
64 + $(CC) $(CFLAGS) $(OFLAGS) aes/aescrypt2.c $(LDFLAGS) -o $@
65
66 hash/hello: hash/hello.c ../library/libxyssl.a
67 echo " CC hash/hello.c"
68 - $(CC) $(CFLAGS) hash/hello.c $(LDFLAGS) -o $@
69 + $(CC) $(CFLAGS) $(OFLAGS) hash/hello.c $(LDFLAGS) -o $@
70
71 hash/md5sum: hash/md5sum.c ../library/libxyssl.a
72 echo " CC hash/md5sum.c"
73 - $(CC) $(CFLAGS) hash/md5sum.c $(LDFLAGS) -o $@
74 + $(CC) $(CFLAGS) $(OFLAGS) hash/md5sum.c $(LDFLAGS) -o $@
75
76 hash/sha1sum: hash/sha1sum.c ../library/libxyssl.a
77 echo " CC hash/sha1sum.c"
78 - $(CC) $(CFLAGS) hash/sha1sum.c $(LDFLAGS) -o $@
79 + $(CC) $(CFLAGS) $(OFLAGS) hash/sha1sum.c $(LDFLAGS) -o $@
80
81 hash/sha2sum: hash/sha2sum.c ../library/libxyssl.a
82 echo " CC hash/sha2sum.c"
83 - $(CC) $(CFLAGS) hash/sha2sum.c $(LDFLAGS) -o $@
84 + $(CC) $(CFLAGS) $(OFLAGS) hash/sha2sum.c $(LDFLAGS) -o $@
85
86 pkey/dh_client: pkey/dh_client.c ../library/libxyssl.a
87 echo " CC pkey/dh_client.c"
88 - $(CC) $(CFLAGS) pkey/dh_client.c $(LDFLAGS) -o $@
89 + $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_client.c $(LDFLAGS) -o $@
90
91 pkey/dh_genprime: pkey/dh_genprime.c ../library/libxyssl.a
92 echo " CC pkey/dh_genprime.c"
93 - $(CC) $(CFLAGS) pkey/dh_genprime.c $(LDFLAGS) -o $@
94 + $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_genprime.c $(LDFLAGS) -o $@
95
96 pkey/dh_server: pkey/dh_server.c ../library/libxyssl.a
97 echo " CC pkey/dh_server.c"
98 - $(CC) $(CFLAGS) pkey/dh_server.c $(LDFLAGS) -o $@
99 + $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_server.c $(LDFLAGS) -o $@
100
101 pkey/mpi_demo: pkey/mpi_demo.c ../library/libxyssl.a
102 echo " CC pkey/mpi_demo.c"
103 - $(CC) $(CFLAGS) pkey/mpi_demo.c $(LDFLAGS) -o $@
104 + $(CC) $(CFLAGS) $(OFLAGS) pkey/mpi_demo.c $(LDFLAGS) -o $@
105
106 pkey/rsa_genkey: pkey/rsa_genkey.c ../library/libxyssl.a
107 echo " CC pkey/rsa_genkey.c"
108 - $(CC) $(CFLAGS) pkey/rsa_genkey.c $(LDFLAGS) -o $@
109 + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_genkey.c $(LDFLAGS) -o $@
110
111 pkey/rsa_sign: pkey/rsa_sign.c ../library/libxyssl.a
112 echo " CC pkey/rsa_sign.c"
113 - $(CC) $(CFLAGS) pkey/rsa_sign.c $(LDFLAGS) -o $@
114 + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_sign.c $(LDFLAGS) -o $@
115
116 pkey/rsa_verify: pkey/rsa_verify.c ../library/libxyssl.a
117 echo " CC pkey/rsa_verify.c"
118 - $(CC) $(CFLAGS) pkey/rsa_verify.c $(LDFLAGS) -o $@
119 + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_verify.c $(LDFLAGS) -o $@
120
121 ssl/ssl_client1: ssl/ssl_client1.c ../library/libxyssl.a
122 echo " CC ssl/ssl_client1.c"
123 - $(CC) $(CFLAGS) ssl/ssl_client1.c $(LDFLAGS) -o $@
124 + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client1.c $(LDFLAGS) -o $@
125
126 ssl/ssl_client2: ssl/ssl_client2.c ../library/libxyssl.a
127 echo " CC ssl/ssl_client2.c"
128 - $(CC) $(CFLAGS) ssl/ssl_client2.c $(LDFLAGS) -o $@
129 + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client2.c $(LDFLAGS) -o $@
130
131 ssl/ssl_server: ssl/ssl_server.c ../library/libxyssl.a
132 echo " CC ssl/ssl_server.c"
133 - $(CC) $(CFLAGS) ssl/ssl_server.c $(LDFLAGS) -o $@
134 + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_server.c $(LDFLAGS) -o $@
135
136 test/benchmark: test/benchmark.c ../library/libxyssl.a
137 echo " CC test/benchmark.c"
138 - $(CC) $(CFLAGS) test/benchmark.c $(LDFLAGS) -o $@
139 + $(CC) $(CFLAGS) $(OFLAGS) test/benchmark.c $(LDFLAGS) -o $@
140
141 test/selftest: test/selftest.c ../library/libxyssl.a
142 echo " CC test/selftest.c"
143 - $(CC) $(CFLAGS) test/selftest.c $(LDFLAGS) -o $@
144 + $(CC) $(CFLAGS) $(OFLAGS) test/selftest.c $(LDFLAGS) -o $@
145
146 clean:
147 rm -f $(APPS)