buildpkg: some fixes, add multilib.conf pkgarch

This commit is contained in:
udeved 2016-06-09 10:54:09 +02:00
parent 5f566540a8
commit 7b6288e0b5
6 changed files with 26 additions and 20 deletions

View file

@ -31,6 +31,7 @@ SETS_PKG = \
ARCH_CONF = \ ARCH_CONF = \
data/pkgarch.d/i686.conf \ data/pkgarch.d/i686.conf \
data/pkgarch.d/x86_64.conf \ data/pkgarch.d/x86_64.conf \
data/pkgarch.d/multilib.conf \
data/pkgarch.d/aarch64.conf \ data/pkgarch.d/aarch64.conf \
data/pkgarch.d/arm.conf \ data/pkgarch.d/arm.conf \
data/pkgarch.d/armv6h.conf \ data/pkgarch.d/armv6h.conf \

View file

@ -41,6 +41,7 @@ display_settings(){
msg2 "buildset_pkg: %s" "${buildset_pkg}" msg2 "buildset_pkg: %s" "${buildset_pkg}"
msg2 "is_buildset: %s" "${is_buildset}" msg2 "is_buildset: %s" "${is_buildset}"
msg2 "pkgarch_dir: %s" "${pkgarch_dir}" msg2 "pkgarch_dir: %s" "${pkgarch_dir}"
msg2 "pkgarches: %s" "$(list_pkgarches ${pkgarch_dir})"
msg "OPTIONS:" msg "OPTIONS:"
msg2 "arch: %s" "${target_arch}" msg2 "arch: %s" "${target_arch}"
@ -133,6 +134,8 @@ while getopts "${opts}" arg; do
esac esac
done done
check_root "$0" "${orig_argv[@]}"
prepare_conf "${target_arch}" prepare_conf "${target_arch}"
mirrors_conf=$(get_pac_mirrors_conf "${target_branch}") 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}) mkchrootpkg_args+=(-r ${work_dir})
check_root "$0" "${orig_argv[@]}"
timer_start=$(get_timer) timer_start=$(get_timer)
eval_buildset "${sets_dir_pkg}" "${buildset_pkg}" eval_buildset "${sets_dir_pkg}" "${buildset_pkg}"

View file

@ -37,8 +37,8 @@ CHOST="@CHOST@"
# -march (or -mcpu) builds exclusively for an architecture # -march (or -mcpu) builds exclusively for an architecture
# -mtune optimizes for an architecture, but builds for whole processor family # -mtune optimizes for an architecture, but builds for whole processor family
CPPFLAGS="-D_FORTIFY_SOURCE=2" CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="@CARCHFLAGS@" CFLAGS="@CFLAGS@"
CXXFLAGS="@CARCHFLAGS@" CXXFLAGS="@CFLAGS@"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro" LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
#-- Make Flags: change this for DistCC/SMP systems #-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2" #MAKEFLAGS="-j2"

View 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"

View file

@ -9,30 +9,34 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # 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(){ get_makepkg_conf(){
local conf_dir=/tmp conf local conf_dir=/tmp conf
conf="$conf_dir/makepkg-$1.conf" conf="$conf_dir/makepkg-$1.conf"
cp "${DATADIR}/makepkg.conf" "$conf" cp "${DATADIR}/makepkg.conf" "$conf"
load_compiler_settings "$1"
sed -i "$conf" \ sed -i "$conf" \
-e "s|@CARCH[@]|$carch|g" \ -e "s|@CARCH[@]|$carch|g" \
-e "s|@CHOST[@]|$chost|g" \ -e "s|@CHOST[@]|$chost|g" \
-e "s|@CARCHFLAGS[@]|$cflags|g" -e "s|@CFLAGS[@]|$cflags|g"
echo "$conf" 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 # $1: target_arch
prepare_conf(){ prepare_conf(){
if ! is_valid_arch_pkg "$1";then if ! is_valid_arch_pkg "$1";then
@ -42,11 +46,8 @@ prepare_conf(){
local pac_arch='default' local pac_arch='default'
if [[ "$1" == 'multilib' ]];then if [[ "$1" == 'multilib' ]];then
load_compiler_settings "x86_64"
pac_arch='multilib' pac_arch='multilib'
is_multilib=true is_multilib=true
else
load_compiler_settings "$1"
fi fi
pacman_conf="${DATADIR}/pacman-$pac_arch.conf" pacman_conf="${DATADIR}/pacman-$pac_arch.conf"

View file

@ -97,7 +97,7 @@ list_pkgarches(){
local arch temp local arch temp
for item in $(ls $1/*.conf); do for item in $(ls $1/*.conf); do
temp=${item##*/} temp=${item##*/}
arch=${arch:-}${arch:+|}${temp%.set} arch=${arch:-}${arch:+|}${temp%.conf}
done done
echo $arch echo $arch
} }
@ -558,7 +558,7 @@ is_valid_init(){
is_valid_arch_pkg(){ is_valid_arch_pkg(){
eval "case $1 in eval "case $1 in
$(list_pkgarches "${pkgarch_dir}")|multilib) return 0 ;; $(list_pkgarches "${pkgarch_dir}")) return 0 ;;
*) return 1 ;; *) return 1 ;;
esac" esac"
} }