forked from PeachyPrinter/dfu-util
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-mac.sh
executable file
·56 lines (47 loc) · 1.2 KB
/
build-mac.sh
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
#!/bin/bash
mkdir -p output
if [ $? != 0 ]; then
echo "FAILURE: Creating output dir"
exit 101
fi
./autogen.sh
if [ $? != 0 ]; then
echo "FAILURE: Autogen"
exit 102
fi
./configure
if [ $? != 0 ]; then
echo "FAILURE: Configure"
exit 103
fi
make
if [ $? != 0 ]; then
echo "FAILURE: make"
exit 104
fi
LIBUSB_PATH=`otool -L src/dfu-util | awk '/libusb/ { print $1 }'`
LIBUSB_NAME=`echo $LIBUSB_PATH | perl -pe 's|^(.*?)([^/]*)$|\2|'`
LIBUSB_OTOOL=`echo @executable_path/${LIBUSB_NAME}`
echo "LIBUSB_PATH: $LIBUSB_PATH"
echo "LIBUSB_NAME: $LIBUSB_NAME"
echo "LIBUSB_OTOOL: $LIBUSB_OTOOL"
cp src/dfu-util output/dfu-util
if [ $? != 0 ]; then
echo "FAILURE: cp src/dfu-util output/dfu-util"
exit 105
fi
cp "${LIBUSB_PATH}" "output/${LIBUSB_NAME}"
if [ $? != 0 ]; then
echo "FAILURE: cp '${LIBUSB_PATH}' 'output/${LIBUSB_NAME}'"
exit 106
fi
chmod 755 "output/${LIBUSB_NAME}"
if [ $? != 0 ]; then
echo "FAILURE: chmod 755 '"'output/${LIBUSB_NAME}'"'"
exit 107
fi
install_name_tool -change "${LIBUSB_PATH}" "${LIBUSB_OTOOL}" output/dfu-util
if [ $? != 0 ]; then
echo "FAILURE: install_name_tool -change '${LIBUSB_PATH}' '${LIBUSB_OTOOL}' output/dfu-util"
exit 108
fi