/
buildpkgrc
140 lines (109 loc) · 3.19 KB
/
buildpkgrc
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# /etc/buildpkgrc: a configuration file for buildpkg
# include the distribution information file
. /etc/distrorc
# compiler flags
arch="$(uname -m)"
case $arch in
i?86)
LIBDIR_SUFFIX=""
CFLAGS="-march=i486 -mtune=i686"
LDFLAGS=""
PKG_ARCH="i486"
PKG_CPU="i486"
;;
x86_64)
LIBDIR_SUFFIX="64"
CFLAGS="-march=x86-64 -mtune=generic -fPIC"
LDFLAGS="-fPIC"
PKG_ARCH="x86_64"
PKG_CPU="x86_64"
;;
armv6)
LIBDIR_SUFFIX=""
CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
LDFLAGS=""
PKG_ARCH="armv6"
PKG_CPU="armv6"
;;
esac
export CFLAGS="$CFLAGS -Os -fomit-frame-pointer -pipe"
export CXXFLAGS="$CFLAGS"
# the number of build threads
BUILD_THREADS="$(cat /proc/cpuinfo | grep processor | wc -l)"
# the package target
BUILD_TARGET="$PKG_ARCH-$DISTRO_NICKNAME-$(uname -s | tr '[:upper:]' '[:lower:]')-gnu"
##############
# base paths #
##############
# the base install prefix for packages
BASE_INSTALL_PREFIX="usr"
# the /etc directory
CONF_DIR="etc"
# the variable data directory
VAR_DIR="var"
# the run-time information directory
RUN_DIR="run"
# the temporary files directory
TMP_DIR="tmp"
##################
# relative paths #
##################
# the binaries directory
BIN_DIR="$BASE_INSTALL_PREFIX/bin"
# the system binaries directory
SBIN_DIR="$BASE_INSTALL_PREFIX/sbin"
# the libraries directory
LIB_DIR="$BASE_INSTALL_PREFIX/lib$LIBDIR_SUFFIX"
# the library executables directory
LIBEXEC_DIR="$LIB_DIR/$PKG_NAME"
#################################
# architecture-independent data #
#################################
# the headers directory
INCLUDE_DIR="$BASE_INSTALL_PREFIX/include"
# the shared data directory
SHARE_DIR="$BASE_INSTALL_PREFIX/share"
# the documentation directory
DOC_DIR="$SHARE_DIR/doc"
# the man pages directory
MAN_DIR="$SHARE_DIR/man"
# the locales directory
LOCALE_DIR="$SHARE_DIR/locale"
#######################
# special directories #
#######################
# the directory for icons
PIXMAP_DIR="$SHARE_DIR/pixmaps"
# the directory for .desktop files
DESKTOP_DIR="$SHARE_DIR/applications"
# the directory for legal information
LEGAL_DIR="$DOC_DIR/legal"
# the directory for init scripts
INIT_SCRIPT_DIR="etc/init.d"
###########
# generic #
###########
# the base options for autotools-based packages
AUTOTOOLS_BASE_OPTS="--build=$BUILD_TARGET \
--prefix=/$BASE_INSTALL_PREFIX \
--bindir=/$BIN_DIR \
--sbindir=/$SBIN_DIR \
--libexecdir=/$LIBEXEC_DIR \
--sysconfdir=/$CONF_DIR \
--localstatedir=/$VAR_DIR \
--libdir=/$LIB_DIR \
--includedir=/$INCLUDE_DIR \
--datarootdir=/$SHARE_DIR \
--datadir=/$SHARE_DIR \
--localedir=/$LOCALE_DIR \
--mandir=/$MAN_DIR \
--docdir=/$DOC_DIR/$PKG_NAME"
# fix the compiler flags and set the pkgconfig search path
for i in $(cat /etc/ld.so.conf)
do
PKG_CONFIG_PATH="$i/pkgconfig:$PKG_CONFIG_PATH"
done
export PKG_CONFIG_PATH
export CFLAGS="$CFLAGS -I/$INCLUDE_DIR -L/$LIB_DIR"
export CXXFLAGS="$CXXFLAGS -I/$INCLUDE_DIR -L/$LIB_DIR"
export LDFLAGS="$LDFLAGS -L/$LIB_DIR"