buildpkg: some fixes, add multilib.conf pkgarch
This commit is contained in:
parent
5f566540a8
commit
7b6288e0b5
6 changed files with 26 additions and 20 deletions
1
Makefile
1
Makefile
|
@ -31,6 +31,7 @@ SETS_PKG = \
|
|||
ARCH_CONF = \
|
||||
data/pkgarch.d/i686.conf \
|
||||
data/pkgarch.d/x86_64.conf \
|
||||
data/pkgarch.d/multilib.conf \
|
||||
data/pkgarch.d/aarch64.conf \
|
||||
data/pkgarch.d/arm.conf \
|
||||
data/pkgarch.d/armv6h.conf \
|
||||
|
|
|
@ -41,6 +41,7 @@ display_settings(){
|
|||
msg2 "buildset_pkg: %s" "${buildset_pkg}"
|
||||
msg2 "is_buildset: %s" "${is_buildset}"
|
||||
msg2 "pkgarch_dir: %s" "${pkgarch_dir}"
|
||||
msg2 "pkgarches: %s" "$(list_pkgarches ${pkgarch_dir})"
|
||||
|
||||
msg "OPTIONS:"
|
||||
msg2 "arch: %s" "${target_arch}"
|
||||
|
@ -133,6 +134,8 @@ while getopts "${opts}" arg; do
|
|||
esac
|
||||
done
|
||||
|
||||
check_root "$0" "${orig_argv[@]}"
|
||||
|
||||
prepare_conf "${target_arch}"
|
||||
|
||||
mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
|
||||
|
@ -142,8 +145,6 @@ mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${bu
|
|||
|
||||
mkchrootpkg_args+=(-r ${work_dir})
|
||||
|
||||
check_root "$0" "${orig_argv[@]}"
|
||||
|
||||
timer_start=$(get_timer)
|
||||
|
||||
eval_buildset "${sets_dir_pkg}" "${buildset_pkg}"
|
||||
|
|
|
@ -37,8 +37,8 @@ CHOST="@CHOST@"
|
|||
# -march (or -mcpu) builds exclusively for an architecture
|
||||
# -mtune optimizes for an architecture, but builds for whole processor family
|
||||
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
||||
CFLAGS="@CARCHFLAGS@"
|
||||
CXXFLAGS="@CARCHFLAGS@"
|
||||
CFLAGS="@CFLAGS@"
|
||||
CXXFLAGS="@CFLAGS@"
|
||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
||||
#-- Make Flags: change this for DistCC/SMP systems
|
||||
#MAKEFLAGS="-j2"
|
||||
|
|
3
data/pkgarch.d/multilib.conf
Normal file
3
data/pkgarch.d/multilib.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
carch="x86_64"
|
||||
chost="x86_64-pc-linux-gnu"
|
||||
cflags="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong"
|
|
@ -9,30 +9,34 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
load_compiler_settings(){
|
||||
local tarch="$1" conf
|
||||
conf=${pkgarch_dir}/$tarch.conf
|
||||
|
||||
[[ -f $conf ]] || return 1
|
||||
|
||||
info "Loading %s compiler settings ..." "$tarch"
|
||||
source $conf
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
get_makepkg_conf(){
|
||||
local conf_dir=/tmp conf
|
||||
conf="$conf_dir/makepkg-$1.conf"
|
||||
|
||||
cp "${DATADIR}/makepkg.conf" "$conf"
|
||||
|
||||
load_compiler_settings "$1"
|
||||
|
||||
sed -i "$conf" \
|
||||
-e "s|@CARCH[@]|$carch|g" \
|
||||
-e "s|@CHOST[@]|$chost|g" \
|
||||
-e "s|@CARCHFLAGS[@]|$cflags|g"
|
||||
-e "s|@CFLAGS[@]|$cflags|g"
|
||||
|
||||
echo "$conf"
|
||||
}
|
||||
|
||||
load_compiler_settings(){
|
||||
local tarch="$1"
|
||||
|
||||
[[ -f ${pkgarch_dir}/$tarch.conf ]] || return 1
|
||||
|
||||
source ${pkgarch_dir}/$tarch.conf
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# $1: target_arch
|
||||
prepare_conf(){
|
||||
if ! is_valid_arch_pkg "$1";then
|
||||
|
@ -42,11 +46,8 @@ prepare_conf(){
|
|||
local pac_arch='default'
|
||||
|
||||
if [[ "$1" == 'multilib' ]];then
|
||||
load_compiler_settings "x86_64"
|
||||
pac_arch='multilib'
|
||||
is_multilib=true
|
||||
else
|
||||
load_compiler_settings "$1"
|
||||
fi
|
||||
|
||||
pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
|
||||
|
|
|
@ -97,7 +97,7 @@ list_pkgarches(){
|
|||
local arch temp
|
||||
for item in $(ls $1/*.conf); do
|
||||
temp=${item##*/}
|
||||
arch=${arch:-}${arch:+|}${temp%.set}
|
||||
arch=${arch:-}${arch:+|}${temp%.conf}
|
||||
done
|
||||
echo $arch
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ is_valid_init(){
|
|||
|
||||
is_valid_arch_pkg(){
|
||||
eval "case $1 in
|
||||
$(list_pkgarches "${pkgarch_dir}")|multilib) return 0 ;;
|
||||
$(list_pkgarches "${pkgarch_dir}")) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue