File: build-package.in

package info (click to toggle)
opensc 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,432 kB
  • ctags: 10,387
  • sloc: ansic: 122,607; xml: 3,256; sh: 1,019; makefile: 530; lex: 92
file content (102 lines) | stat: -rwxr-xr-x 3,835 bytes parent folder | download
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
#!/bin/bash
# Building the installer is only tested and supported on 10.9 with Xcode 5.0.1
# Command line tools for Xcode required, install with "xcode-select --install"
# Built package targets 10.9+
# Building should also work on older versions with older revisions or slight changes, YMMV

set -ex
test -x ./configure || ./bootstrap
BUILDPATH=${PWD}

# Use new locations for SDK on 10.8+
OSX_RELEASE=`sw_vers -productVersion`
case ${OSX_RELEASE:0:4} in
	"10.8")
		SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"
		export CFLAGS="-isysroot $SYSROOT -arch i386 -arch x86_64 -mmacosx-version-min=10.8"
	;;
	"10.9")
		SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"
		export CFLAGS="-isysroot $SYSROOT -arch i386 -arch x86_64 -mmacosx-version-min=10.9"
	;;
	*)
		SYSROOT="/Developer/SDKs/MacOSX10.6.sdk"
		export CFLAGS="-isysroot $SYSROOT -arch i386 -arch x86_64 -mmacosx-version-min=10.6"
	;;
esac

# OpenSSL is deprecated on OSX since 10.7 and that generates lots of
# "false positive" warnings and there is no alternative option.
# Just ignore these warning for now by silencing them.
CFLAGS="$CFLAGS -Wno-deprecated-declarations"

export SED=/usr/bin/sed
PREFIX=/Library/OpenSC
export PKG_CONFIG_PATH=/usr/lib/pkgconfig

./configure --prefix=$PREFIX \
--sysconfdir=$PREFIX/etc \
--disable-dependency-tracking \
--enable-shared \
--disable-static \
--enable-strict \
--disable-assert \
--enable-sm # TODO: remove this (must be sensible default in master)

# always make clean
make clean

# compile
make -j 2

# copy files
rm -rf target
make install DESTDIR=${BUILDPATH}/target

# remove garbage
rm -f target/Library/OpenSC/lib/*.la

# generate .bundle (required by Adobe Acrobat)
./MacOSX/libtool-bundle target/Library/OpenSC/lib/opensc-pkcs11.so target/Library/OpenSC/lib

# Build engine_pkcs11 + libp11
test -d libp11 || git clone http://github.com/OpenSC/libp11.git
(cd libp11
test -x configure || ./bootstrap
./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=${BUILDPATH}/build && make && make install)
test -d engine_pkcs11 || git clone http://github.com/OpenSC/engine_pkcs11.git
(cd engine_pkcs11
test -x configure || ./bootstrap
PKG_CONFIG_PATH=${BUILDPATH}/build/lib/pkgconfig:${PKG_CONFIG_PATH} ./configure --disable-dependency-tracking --prefix=/Library/OpenSC && make install DESTDIR=${BUILDPATH}/target)

# Check out OpenSC.tokend, if not already fetched.
if ! test -e OpenSC.tokend; then
	git clone http://github.com/OpenSC/OpenSC.tokend.git
fi

# Create the symlink to OpenSC sources
test -L OpenSC.tokend/build/opensc-src || ln -sf ${BUILDPATH}/src OpenSC.tokend/build/opensc-src

# Build and copy OpenSC.tokend
xcodebuild -configuration Deployment -project OpenSC.tokend/Tokend.xcodeproj

# Prepare target root
# Copy Tokend
mkdir -p target/System/Library/Security/tokend
mv OpenSC.tokend/build/OpenSC.tokend target/System/Library/Security/tokend
# The "UnInstaller"
mkdir -p target/usr/local/bin
cp MacOSX/opensc-uninstall target/usr/local/bin

# Build package
pkgbuild --root target --scripts MacOSX/scripts --identifier org.opensc-project.mac --version @PACKAGE_VERSION@ --install-location / OpenSC.pkg
# Build product
productbuild --distribution MacOSX/Distribution.xml --package-path . --resources MacOSX/resources OpenSC-@PACKAGE_VERSION@.pkg

# Build "uninstaller"
pkgbuild --nopayload --identifier org.opensc-project.mac.uninstall --scripts MacOSX/uninstaller-scripts Uninstall_OpenSC.pkg

# Create .dmg
rm -f OpenSC-@PACKAGE_VERSION@.dmg
TIMESTAMP=$(date +%Y.%m.%d)
hdiutil create -srcfolder Uninstall_OpenSC.pkg -srcfolder OpenSC-@PACKAGE_VERSION@.pkg -volname "OpenSC @PACKAGE_VERSION@ for Mac OS X 10.9+ (${TIMESTAMP})" OpenSC-@PACKAGE_VERSION@.dmg