1# Copyright (C) 2013-2015 Yubico AB 2# 3# This program is free software; you can redistribute it and/or modify it 4# under the terms of the GNU Lesser General Public License as published by 5# the Free Software Foundation; either version 2.1, or (at your option) 6# any later version. 7# 8# This program is distributed in the hope that it will be useful, but 9# WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 11# General Public License for more details. 12# 13# You should have received a copy of the GNU Lesser General Public License 14# along with this program; if not, see <http://www.gnu.org/licenses/>. 15 16LIBJSONVERSION=0.12.1 17HIDAPIHASH=a6a622ffb680c55da0de787ff93b80280498330f 18PACKAGE=libu2f-host 19 20all: usage doit 21 22.PHONY: usage 23usage: 24 @if test -z "$(VERSION)"; then \ 25 echo "Try this instead:"; \ 26 echo " make VERSION=[VERSION]"; \ 27 echo "For example:"; \ 28 echo " make VERSION=1.6.0"; \ 29 exit 1; \ 30 fi 31 32doit: 33 rm -rf tmp && mkdir tmp && cd tmp && \ 34 mkdir -p root/licenses && \ 35 cp ../json-c-$(LIBJSONVERSION).tar.gz . || \ 36 curl -O -L https://s3.amazonaws.com/json-c_releases/releases/json-c-$(LIBJSONVERSION).tar.gz && \ 37 tar xfz json-c-$(LIBJSONVERSION).tar.gz && \ 38 cd json-c-$(LIBJSONVERSION) && \ 39 ./configure --prefix=$(PWD)/tmp$(ARCH)/root CFLAGS=-mmacosx-version-min=10.6 && \ 40 make install check && \ 41 cp COPYING $(PWD)/tmp$(ARCH)/root/licenses/json-c.txt && \ 42 cd .. && \ 43 git clone https://github.com/signal11/hidapi.git && \ 44 cd hidapi && \ 45 git checkout $(HIDAPIHASH) && \ 46 ./bootstrap && \ 47 ./configure --prefix=$(PWD)/tmp$(ARCH)/root CFLAGS=-mmacosx-version-min=10.6 && \ 48 make install check && \ 49 cp LICENSE-gpl3.txt $(PWD)/tmp$(ARCH)/root/licenses/hidapi.txt && \ 50 cd .. && \ 51 cp ../$(PACKAGE)-$(VERSION).tar.xz . && \ 52 tar xfJ $(PACKAGE)-$(VERSION).tar.xz && \ 53 cd $(PACKAGE)-$(VERSION)/ && \ 54 PKG_CONFIG_PATH=$(PWD)/tmp$(ARCH)/root/lib/pkgconfig ./configure --prefix=$(PWD)/tmp$(ARCH)/root CFLAGS=-mmacosx-version-min=10.6 && \ 55 make install check && \ 56 install_name_tool -id @executable_path/../lib/libjson-c.2.dylib $(PWD)/tmp/root/lib/libjson-c.2.dylib && \ 57 install_name_tool -id @executable_path/../lib/libhidapi.0.dylib $(PWD)/tmp/root/lib/libhidapi.0.dylib && \ 58 install_name_tool -id @executable_path/../lib/libu2f-host.0.dylib $(PWD)/tmp/root/lib/libu2f-host.0.dylib && \ 59 install_name_tool -change $(PWD)/tmp/root/lib/libjson-c.2.dylib @executable_path/../lib/libjson-c.2.dylib $(PWD)/tmp/root/lib/libu2f-host.0.dylib && \ 60 install_name_tool -change $(PWD)/tmp/root/lib/libhidapi.0.dylib @executable_path/../lib/libhidapi.0.dylib $(PWD)/tmp/root/lib/libu2f-host.0.dylib && \ 61 for executable in $(PWD)/tmp/root/bin/*; do \ 62 install_name_tool -change $(PWD)/tmp/root/lib/libjson-c.2.dylib @executable_path/../lib/libjson-c.2.dylib $$executable ; \ 63 install_name_tool -change $(PWD)/tmp/root/lib/libhidapi.0.dylib @executable_path/../lib/libhidapi.0.dylib $$executable ; \ 64 install_name_tool -change $(PWD)/tmp/root/lib/libu2f-host.0.dylib @executable_path/../lib/libu2f-host.0.dylib $$executable ; \ 65 done && \ 66 rm $(PWD)/tmp/root/lib/*.la && \ 67 rm -rf $(PWD)/tmp/root/lib/pkgconfig && \ 68 cp COPYING $(PWD)/tmp$(ARCH)/root/licenses/$(PACKAGE).txt && \ 69 cd .. && \ 70 cd root && \ 71 zip -r ../../$(PACKAGE)-$(VERSION)-mac.zip * 72 73upload: 74 @if test ! -d "$(YUBICO_WWW_REPO)"; then \ 75 echo "www repo not found!"; \ 76 echo "Make sure that YUBICO_WWW_REPO is set"; \ 77 exit 1; \ 78 fi 79 gpg --detach-sign --default-key $(PGPKEYID) $(PACKAGE)-$(VERSION)-mac.zip 80 gpg --verify $(PACKAGE)-$(VERSION)-mac.zip.sig 81 $(YUBICO_WWW_REPO)/publish $(PACKAGE) $(VERSION) $(PACKAGE)-$(VERSION)-mac.zip* 82