| 1 | BUILDHOME = $(PWD) |
|---|
| 2 | OPENSSLVERSION = 0.9.8h |
|---|
| 3 | OPENSCVERSION = 0.11.6 |
|---|
| 4 | OPENSSHVERSION = 5.1p1 |
|---|
| 5 | LIBP11VERSION = 0.2.4 |
|---|
| 6 | ENGINEVERSION = 0.1.5 |
|---|
| 7 | IFDEGATEVERSION = 0.05 |
|---|
| 8 | LIBUSBVERSION = 0.1.12 |
|---|
| 9 | PKGCONFIGVERSION = 0.22 |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | all: build-pkg-config build-openssl build-opensc build-libp11 build-engine build-openssh build-libusb build-ifd-egate |
|---|
| 13 | clean: clean-pkg-config clean-openssl clean-opensc clean-libp11 clean-engine clean-openssh clean-libusb clean-ifd-egate |
|---|
| 14 | transfer: |
|---|
| 15 | tar czf compiled-i386.tgz *-i386 |
|---|
| 16 | |
|---|
| 17 | clean-pkg-config: |
|---|
| 18 | rm -rf pkg-config |
|---|
| 19 | rm -rf compiled-pkg-config |
|---|
| 20 | rm -f fetch-pkg-config build-pkg-config |
|---|
| 21 | |
|---|
| 22 | clean-openssl: |
|---|
| 23 | rm -rf openssl |
|---|
| 24 | rm -rf compiled-openssl-i386 |
|---|
| 25 | rm -f fetch-openssl build-openssl |
|---|
| 26 | |
|---|
| 27 | clean-opensc: |
|---|
| 28 | rm -rf opensc |
|---|
| 29 | rm -rf compiled-opensc-i386 |
|---|
| 30 | rm -f fetch-opensc build-opensc |
|---|
| 31 | |
|---|
| 32 | clean-libp11: |
|---|
| 33 | rm -rf libp11 |
|---|
| 34 | rm -rf compiled-libp11-i386 |
|---|
| 35 | rm -f fetch-libp11 build-libp11 |
|---|
| 36 | |
|---|
| 37 | clean-engine: |
|---|
| 38 | rm -rf engine_pkcs11 |
|---|
| 39 | rm -rf compiled-engine-i386 |
|---|
| 40 | rm -f fetch-engine build-engine |
|---|
| 41 | |
|---|
| 42 | clean-openssh: |
|---|
| 43 | rm -rf openssh |
|---|
| 44 | rm -rf compiled-openssh-i386 |
|---|
| 45 | rm -f fetch-openssh build-openssh |
|---|
| 46 | |
|---|
| 47 | clean-libusb: |
|---|
| 48 | rm -rf libusb |
|---|
| 49 | rm -rf compiled-libusb-i386 |
|---|
| 50 | rm -f fetch-libusb build-libusb |
|---|
| 51 | |
|---|
| 52 | clean-ifd-egate: |
|---|
| 53 | rm -rf ifd-egate |
|---|
| 54 | rm -rf compiled-ifd-egate-i386 |
|---|
| 55 | rm -f fetch-ifd-egate build-ifd-egate |
|---|
| 56 | |
|---|
| 57 | pkg-config-$(PKGCONFIGVERSION).tar.gz: |
|---|
| 58 | curl -O http://pkgconfig.freedesktop.org/releases/$@ |
|---|
| 59 | |
|---|
| 60 | openssl-$(OPENSSLVERSION).tar.gz: |
|---|
| 61 | curl -O http://www.openssl.org/source/$@ |
|---|
| 62 | #curl -O http://mirrors.usc.edu/pub/openssl/snapshot/$@ |
|---|
| 63 | |
|---|
| 64 | opensc-$(OPENSCVERSION).tar.gz: |
|---|
| 65 | curl -O http://www.opensc-project.org/files/opensc/$@ |
|---|
| 66 | # curl -O http://www.opensc-project.org/files/opensc/snapshots/$@ |
|---|
| 67 | # curl -O http://www.opensc-project.org/files/opensc/testing/$@ |
|---|
| 68 | |
|---|
| 69 | libp11-$(LIBP11VERSION).tar.gz: |
|---|
| 70 | curl -O http://www.opensc-project.org/files/libp11/$@ |
|---|
| 71 | |
|---|
| 72 | engine_pkcs11-$(ENGINEVERSION).tar.gz: |
|---|
| 73 | curl -O http://www.opensc-project.org/files/engine_pkcs11/$@ |
|---|
| 74 | |
|---|
| 75 | openssh-$(OPENSSHVERSION).tar.gz: |
|---|
| 76 | curl -O http://ftp.belnet.be/packages/openbsd/OpenSSH/portable/$@ |
|---|
| 77 | |
|---|
| 78 | ifd-egate-$(IFDEGATEVERSION)-patched.tar.gz: |
|---|
| 79 | curl -O http://www.luusa.org/~wbx/sc/$@ |
|---|
| 80 | |
|---|
| 81 | libusb-$(LIBUSBVERSION).tar.gz: |
|---|
| 82 | curl -O http://switch.dl.sourceforge.net/sourceforge/libusb/$@ |
|---|
| 83 | |
|---|
| 84 | fetch-pkg-config: pkg-config-$(PKGCONFIGVERSION).tar.gz |
|---|
| 85 | rm -rf pkg-config |
|---|
| 86 | tar xzvf $^ |
|---|
| 87 | mv pkg-config-$(PKGCONFIGVERSION) pkg-config |
|---|
| 88 | touch $@ |
|---|
| 89 | |
|---|
| 90 | fetch-openssl: openssl-$(OPENSSLVERSION).tar.gz |
|---|
| 91 | rm -rf openssl |
|---|
| 92 | tar xzvf $^ |
|---|
| 93 | mv openssl-$(OPENSSLVERSION) openssl |
|---|
| 94 | touch $@ |
|---|
| 95 | |
|---|
| 96 | fetch-opensc: opensc-$(OPENSCVERSION).tar.gz |
|---|
| 97 | rm -rf opensc |
|---|
| 98 | tar xzvf $^ |
|---|
| 99 | mv opensc-$(OPENSCVERSION) opensc |
|---|
| 100 | touch $@ |
|---|
| 101 | |
|---|
| 102 | fetch-libp11: libp11-$(LIBP11VERSION).tar.gz |
|---|
| 103 | rm -rf libp11 |
|---|
| 104 | tar xzvf $^ |
|---|
| 105 | mv libp11-$(LIBP11VERSION) libp11 |
|---|
| 106 | touch $@ |
|---|
| 107 | |
|---|
| 108 | fetch-engine: engine_pkcs11-$(ENGINEVERSION).tar.gz |
|---|
| 109 | rm -rf engine_pkcs11 |
|---|
| 110 | tar xzvf $^ |
|---|
| 111 | mv engine_pkcs11-$(ENGINEVERSION) engine_pkcs11 |
|---|
| 112 | touch $@ |
|---|
| 113 | |
|---|
| 114 | fetch-openssh: openssh-$(OPENSSHVERSION).tar.gz |
|---|
| 115 | rm -rf openssh |
|---|
| 116 | tar xzvf $^ |
|---|
| 117 | mv openssh-$(OPENSSHVERSION) openssh |
|---|
| 118 | cd openssh && patch -p1 <../opensc/src/openssh/ask-for-pin.diff |
|---|
| 119 | touch $@ |
|---|
| 120 | |
|---|
| 121 | fetch-libusb: libusb-$(LIBUSBVERSION).tar.gz |
|---|
| 122 | rm -rf libusb |
|---|
| 123 | tar xzvf $^ |
|---|
| 124 | mv libusb-$(LIBUSBVERSION) libusb |
|---|
| 125 | cd libusb && patch < ../libusb-runloop.patch |
|---|
| 126 | touch $@ |
|---|
| 127 | |
|---|
| 128 | fetch-ifd-egate: ifd-egate-$(IFDEGATEVERSION)-patched.tar.gz |
|---|
| 129 | rm -rf ifd-egate |
|---|
| 130 | tar xzvf $^ |
|---|
| 131 | mv ifd-egate-$(IFDEGATEVERSION) ifd-egate |
|---|
| 132 | touch $@ |
|---|
| 133 | |
|---|
| 134 | build-pkg-config: fetch-pkg-config |
|---|
| 135 | cd pkg-config && \ |
|---|
| 136 | ./configure --prefix=$(BUILDHOME)/compiled-pkg-config && \ |
|---|
| 137 | make && \ |
|---|
| 138 | make install |
|---|
| 139 | touch $@ |
|---|
| 140 | |
|---|
| 141 | build-openssl: fetch-openssl |
|---|
| 142 | cd openssl && \ |
|---|
| 143 | ./config --prefix=/Library/OpenSC shared -DDSO_DLFCN -DHAVE_DLFCN_H && \ |
|---|
| 144 | make && \ |
|---|
| 145 | make INSTALL_PREFIX=$(BUILDHOME)/compiled-openssl-i386 install |
|---|
| 146 | rm -f $(BUILDHOME)/compiled-openssl-i386/Library/OpenSC/bin/openssl_fips_fingerprint |
|---|
| 147 | touch $@ |
|---|
| 148 | |
|---|
| 149 | build-opensc: fetch-opensc |
|---|
| 150 | cd opensc && \ |
|---|
| 151 | PKG_CONFIG="$(BUILDHOME)/compiled-pkg-config/bin/pkg-config" \ |
|---|
| 152 | OPENSSL_CFLAGS="-I$(BUILDHOME)/compiled-openssl-i386/Library/OpenSC/include" \ |
|---|
| 153 | OPENSSL_LIBS="-L$(BUILDHOME)/compiled-openssl-i386/Library/OpenSC/lib -lcrypto" \ |
|---|
| 154 | ./configure --prefix=/Library/OpenSC --enable-pcsc --sysconfdir=/Library/OpenSC/etc && \ |
|---|
| 155 | make && \ |
|---|
| 156 | make install prefix=$(BUILDHOME)/compiled-opensc-i386/Library/OpenSC |
|---|
| 157 | touch $@ |
|---|
| 158 | |
|---|
| 159 | build-libp11: fetch-libp11 |
|---|
| 160 | cd libp11 && \ |
|---|
| 161 | OPENSSL_CFLAGS="-I$(BUILDHOME)/compiled-openssl-i386/Library/OpenSC/include" \ |
|---|
| 162 | OPENSSL_LIBS="-L$(BUILDHOME)/compiled-openssl-i386/Library/OpenSC/lib -lcrypto" \ |
|---|
| 163 | ./configure --prefix=/Library/OpenSC && \ |
|---|
| 164 | make && \ |
|---|
| 165 | make install prefix=$(BUILDHOME)/compiled-libp11-i386/Library/OpenSC |
|---|
| 166 | touch $@ |
|---|
| 167 | |
|---|
| 168 | build-engine: fetch-engine |
|---|
| 169 | cd engine_pkcs11 && \ |
|---|
| 170 | PKG_CONFIG="$(BUILDHOME)/compiled-pkg-config/bin/pkg-config" \ |
|---|
| 171 | LIBP11_CFLAGS="-I$(BUILDHOME)/compiled-libp11-i386/Library/OpenSC/include" \ |
|---|
| 172 | LIBP11_LIBS="-L$(BUILDHOME)/compiled-libp11-i386/Library/OpenSC/lib -lp11" \ |
|---|
| 173 | OPENSSL_CFLAGS="-I$(BUILDHOME)/compiled-openssl/Library/OpenSC/include" \ |
|---|
| 174 | OPENSSL_LIBS="-L$(BUILDHOME)/compiled-openssl/Library/OpenSC/lib -lcrypto" \ |
|---|
| 175 | ./configure --prefix=/Library/OpenSC && \ |
|---|
| 176 | make && \ |
|---|
| 177 | make install prefix=$(BUILDHOME)/compiled-engine-i386/Library/OpenSC |
|---|
| 178 | touch $@ |
|---|
| 179 | |
|---|
| 180 | build-openssh: fetch-openssh |
|---|
| 181 | cd openssh && \ |
|---|
| 182 | DYLD_LIBRARY_PATH="$(BUILDHOME)/compiled-openssl-i386/Library/OpenSC/lib" \ |
|---|
| 183 | ./configure --prefix=/Library/OpenSC \ |
|---|
| 184 | --with-opensc=$(BUILDHOME)/compiled-opensc-i386/Library/OpenSC \ |
|---|
| 185 | --with-ssl-dir=$(BUILDHOME)/compiled-openssl-i386/Library/OpenSC --without-zlib-version-check \ |
|---|
| 186 | --with-ldflags="-L$(BUILDHOME)/compiled-openssl-i386/Library/OpenSC/lib -L$(BUILDHOME)/compiled-opensc-i386/Library/OpenSC/lib" && \ |
|---|
| 187 | make && \ |
|---|
| 188 | make install-nokeys prefix=$(BUILDHOME)/compiled-openssh-i386/Library/OpenSC |
|---|
| 189 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/share/man $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man |
|---|
| 190 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/scp |
|---|
| 191 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/sftp |
|---|
| 192 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/ssh-keyscan |
|---|
| 193 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/etc/ssh_host* |
|---|
| 194 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/etc/sshd_config |
|---|
| 195 | rm -rf $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/libexec |
|---|
| 196 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/scp.1 |
|---|
| 197 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/sftp.1 |
|---|
| 198 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/ssh-keyscan.1 |
|---|
| 199 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man5/sshd_config.5 |
|---|
| 200 | rm -rf $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man8 |
|---|
| 201 | rm -rf $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/sbin |
|---|
| 202 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/ssh $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/scssh |
|---|
| 203 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/ssh-add $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/scssh-add |
|---|
| 204 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/ssh-agent $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/scssh-agent |
|---|
| 205 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/ssh-keygen $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/scssh-keygen |
|---|
| 206 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/slogin |
|---|
| 207 | cd $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/bin/ && ln -s ./scssh scslogin |
|---|
| 208 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/ssh-add.1 $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/scssh-add.1 |
|---|
| 209 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/ssh-agent.1 $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/scssh-agent.1 |
|---|
| 210 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/ssh-keygen.1 $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/scssh-keygen.1 |
|---|
| 211 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/ssh.1 $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/scssh.1 |
|---|
| 212 | rm -f $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/slogin.1 |
|---|
| 213 | cd $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man1/ && ln -s ./scssh.1 scslogin.1 |
|---|
| 214 | mv $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man5/ssh_config.5 $(BUILDHOME)/compiled-openssh-i386/Library/OpenSC/man/man5/scssh_config.5 |
|---|
| 215 | touch $@ |
|---|
| 216 | |
|---|
| 217 | build-libusb: fetch-libusb |
|---|
| 218 | cd libusb && \ |
|---|
| 219 | ./configure --prefix=/Library/OpenSC --disable-build-docs && \ |
|---|
| 220 | make && \ |
|---|
| 221 | make install prefix=$(BUILDHOME)/compiled-libusb-i386/Library/OpenSC |
|---|
| 222 | touch $@ |
|---|
| 223 | |
|---|
| 224 | build-ifd-egate: fetch-ifd-egate |
|---|
| 225 | cd ifd-egate && \ |
|---|
| 226 | USB_CFLAGS="-I$(BUILDHOME)/compiled-libusb-i386/Library/OpenSC/include -I/System/Library/Frameworks/PCSC.framework/Headers" \ |
|---|
| 227 | USB_LDFLAGS="-L$(BUILDHOME)/compiled-libusb-i386/Library/OpenSC/lib -lusb -Wl,-framework -Wl,PCSC" \ |
|---|
| 228 | make -f Makefile-OSX |
|---|
| 229 | mkdir -p $(BUILDHOME)/compiled-ifd-egate-i386/usr/libexec/SmartCardServices/drivers/ifd-egate.bundle/Contents/MacOS |
|---|
| 230 | cp ifd-egate/Info.plist-OSX $(BUILDHOME)/compiled-ifd-egate-i386/usr/libexec/SmartCardServices/drivers/ifd-egate.bundle/Contents/Info.plist |
|---|
| 231 | cp ifd-egate/libifd_egate.dylib $(BUILDHOME)/compiled-ifd-egate-i386/usr/libexec/SmartCardServices/drivers/ifd-egate.bundle/Contents/MacOS |
|---|
| 232 | touch $@ |
|---|