forked from pypilot/pypilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pypilot.build
113 lines (74 loc) · 2.56 KB
/
pypilot.build
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
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
#
######################################################
# Build script for RPI #
# #
# See .info for details #
# #
######################################################
######################################################
# Configure extension creation parameters #
######################################################
# pypilot.build is a build script to build the pypilot
# tinycore linux package
# it can be run to update the packages in tinypilot
# then tinypilot is restarted
SRCNAM=pypilot
WRKDIR=.
EXTNAM=pypilot
TMPDIR=/tmp/$EXTNAM
PYTDIR=/usr/local/lib/python2.7/site-packages
######################################################
# Prepare extension creation #
######################################################
INITIALDIR=$PWD
# Remove dirs and files left from previous creation
#sudo pip uninstall Flask
# Create temporary directory
mkdir -p $TMPDIR$PYTDIR
######################################################
# Compile extension #
######################################################
# Install in place
export CFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp"
export CXXFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp"
# Unpack source in current directory
#tar -xf $SRCNAM
# Configure it
cd $WRKDIR
# delete old dist
rm -rf dist build
# Build and Install
python setup.py build # stupid script copies files before swigging!
python setup.py bdist
tar xvf dist/*tar.gz -C $TMPDIR
# Delete compilation work directory
cd ..
#rm -r -f $WRKDIR
INSDIR=$TMPDIR$PYTDIR/$PYNAM
rm -rf $INSDIR/*pyc
# Delete *.pyc files
find $TMPDIR/ -name *.pyc | xargs rm -r
# Adjust directory access rigths
find $TMPDIR/ -type d | xargs chmod -v 755;
find $TMPDIR | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded
###################################################
# Create base extension in temp dir #
###################################################
cd $TMPDIR
cd ..
mksquashfs $TMPDIR $EXTNAM.tcz
cd $TMPDIR
find usr -not -type d > $EXTNAM.tcz.list
mv -f ../$EXTNAM.tcz .
# Create md5 file
md5sum $EXTNAM.tcz > $EXTNAM.tcz.md5.txt
# copy extension files
echo "old: /mnt/mmcblk0p2/tce/optional/$EXTNAM.tcz"
ls -l /mnt/mmcblk0p2/tce/optional/$EXTNAM.tcz
echo "new: $EXTNAM.tcz"
ls -l $EXTNAM.tcz
sudo cp -f $EXTNAM.tcz* /mnt/mmcblk0p2/tce/optional
# Cleanup temp directory
rm -rf *
cd $INITIALDIR