1 | #!/bin/bash
|
---|
2 |
|
---|
3 | ### OPENSSL ###
|
---|
4 | # deps
|
---|
5 | # zlib
|
---|
6 | # krb5 (optional)
|
---|
7 | # TODO: for krb5 support some hackery is required
|
---|
8 |
|
---|
9 | cd ${SRC}
|
---|
10 | LOG=openssl-blfs.log
|
---|
11 | SELF=`basename ${0}`
|
---|
12 | set_buildenv
|
---|
13 | set_libdirname
|
---|
14 | setup_multiarch
|
---|
15 |
|
---|
16 | unpack_tarball openssl-${OPENSSL_VER} &&
|
---|
17 | cd ${PKGDIR}
|
---|
18 |
|
---|
19 | # patching...
|
---|
20 | # TODO: check 0.9.7e to see which patches apply
|
---|
21 | case ${OPENSSL_VER} in
|
---|
22 | 0.9.7d )
|
---|
23 | # Adds a Configure target for linux-x86_64-32
|
---|
24 | apply_patch openssl-0.9.7d-32bit_x86_64
|
---|
25 | # Adds a make option ( LIBDIR ) for setting ${libdirname}
|
---|
26 | apply_patch openssl-0.9.7d-allow_lib64
|
---|
27 | # Fix for brokenness in kssl.h
|
---|
28 | # ( applies to 0.9.7f. For mit krb5 1.3.5, test for 1.4 )
|
---|
29 | apply_patch openssl-0.9.7d-mit_krb5
|
---|
30 | ;;
|
---|
31 | 0.9.7f )
|
---|
32 | # Adds a Configure target for linux-x86_64-32
|
---|
33 | apply_patch openssl-0.9.7f-32bit_x86_64
|
---|
34 | # Adds a make option ( LIBDIR ) for setting ${libdirname}
|
---|
35 | apply_patch openssl-0.9.7f-allow_lib64
|
---|
36 | # Fix for brokenness in kssl.h
|
---|
37 | # ( applies to 0.9.7f. For mit krb5 1.3.5, test for 1.4 )
|
---|
38 | apply_patch openssl-0.9.7d-mit_krb5
|
---|
39 | ;;
|
---|
40 | 0.9.7g )
|
---|
41 | # Adds a Configure target for linux-x86_64-32
|
---|
42 | apply_patch openssl-0.9.7f-32bit_x86_64
|
---|
43 | # Adds a make option ( LIBDIR ) for setting ${libdirname}
|
---|
44 | apply_patch openssl-0.9.7f-allow_lib64
|
---|
45 | ;;
|
---|
46 | esac
|
---|
47 |
|
---|
48 | # TODO: *** MORE WILL NEED TO GO HERE ###
|
---|
49 | # Only known to work with x86_64 so far... further edits to Configure
|
---|
50 | # may be required to hardcode ARCH_CFLAGS in (depending on arch)
|
---|
51 | CONFIG="config"
|
---|
52 | if [ "Y" = "${MULTIARCH}" ]; then
|
---|
53 | case ${BUILDENV} in
|
---|
54 | 64 )
|
---|
55 | # set arch specific 64 bit compilation flags
|
---|
56 | case ${TGT_ARCH} in
|
---|
57 | x86_64 )
|
---|
58 | CONFIG_TARGET="linux-x86_64"
|
---|
59 | CONFIG="Configure"
|
---|
60 | ;;
|
---|
61 | sparc* )
|
---|
62 | CONFIG_TARGET="linux64-sparcv9"
|
---|
63 | CONFIG="Configure"
|
---|
64 | ;;
|
---|
65 | powerpc* | ppc* )
|
---|
66 | ;;
|
---|
67 | s390* )
|
---|
68 | CONFIG_TARGET="linux-s390x"
|
---|
69 | CONFIG="Configure"
|
---|
70 | ;;
|
---|
71 | esac
|
---|
72 | ;;
|
---|
73 | 32 )
|
---|
74 | case ${TGT_ARCH} in
|
---|
75 | x86_64 | x86-64 )
|
---|
76 | CONFIG_TARGET="linux-x86_64-32"
|
---|
77 | CONFIG="Configure"
|
---|
78 | ;;
|
---|
79 | sparc* )
|
---|
80 | # ultrasparc specific here ...
|
---|
81 | CONFIG_TARGET="linux-sparcv9"
|
---|
82 | CONFIG="Configure"
|
---|
83 | ;;
|
---|
84 | powerpc* | ppc* )
|
---|
85 | ;;
|
---|
86 | esac
|
---|
87 | ;;
|
---|
88 | 31 )
|
---|
89 | case ${TGT_ARCH} in
|
---|
90 | s390* )
|
---|
91 | CONFIG_TARGET="linux-s390"
|
---|
92 | CONFIG="Configure"
|
---|
93 | ;;
|
---|
94 | esac
|
---|
95 | ;;
|
---|
96 | esac
|
---|
97 | fi
|
---|
98 |
|
---|
99 | # Dont clobber existing docs
|
---|
100 | sed 's/^passwd/openssl-passwd/' doc/apps/passwd.pod \
|
---|
101 | > doc/apps/openssl-passwd.pod &&
|
---|
102 | rm doc/apps/passwd.pod &&
|
---|
103 | mv doc/crypto/{,openssl_}threads.pod &&
|
---|
104 |
|
---|
105 | #TODO: use -mtune or -march?
|
---|
106 | # also need to cater for non-x86
|
---|
107 | sed -i -e 's/-m486/-mtune=i486/' \
|
---|
108 | -e 's/-mcpu=/-mtune=/' Configure
|
---|
109 |
|
---|
110 | # HACK: hack Configure to find krb libraries under ${libdirname}...
|
---|
111 | #if [ ! "${libdirname}" = "lib" ]; then
|
---|
112 | # sed -i -e "s@/lib\( \|\"\)@/${libdirname}\1@g" Configure
|
---|
113 | #fi
|
---|
114 |
|
---|
115 | max_log_init OpenSSL ${OPENSSL_VER} "native (shared)" ${CONFLOGS} ${LOG}
|
---|
116 | ./${CONFIG} ${CONFIG_TARGET} \
|
---|
117 | --prefix=/usr \
|
---|
118 | --openssldir=/etc/ssl \
|
---|
119 | --with-krb5-dir=/usr \
|
---|
120 | --with-krb5-flavor=MIT \
|
---|
121 | threads zlib-dynamic shared \
|
---|
122 | >> ${LOGFILE} 2>&1 &&
|
---|
123 | echo " o Configure OK" &&
|
---|
124 |
|
---|
125 | min_log_init ${BUILDLOGS} &&
|
---|
126 | make ${PMFLAGS} LIBDIR=${libdirname} MANPATH=/usr/share/man \
|
---|
127 | >> ${LOGFILE} 2>&1 &&
|
---|
128 | echo " o Build OK" &&
|
---|
129 |
|
---|
130 | min_log_init ${TESTLOGS} &&
|
---|
131 | make LIBDIR=${libdirname} test \
|
---|
132 | >> ${LOGFILE} 2>&1 &&
|
---|
133 | echo " o Test OK" &&
|
---|
134 |
|
---|
135 | min_log_init ${INSTLOGS} &&
|
---|
136 | make MANDIR=/usr/share/man LIBDIR=${libdirname} install \
|
---|
137 | >> ${LOGFILE} 2>&1 &&
|
---|
138 | echo " o ALL OK" || barf
|
---|
139 |
|
---|