Lines 58-103
Link Here
|
58 |
|
58 |
|
59 |
# The following is Gentoo-specific. |
59 |
# The following is Gentoo-specific. |
60 |
epatch "${FILESDIR}/${PV}-no-static-hack.patch" |
60 |
epatch "${FILESDIR}/${PV}-no-static-hack.patch" |
|
|
61 |
|
62 |
# The following is experimental, probably shouldn't go in. |
63 |
epatch "${FILESDIR}/${PV}-threads.patch" |
61 |
} |
64 |
} |
62 |
|
65 |
|
63 |
src_compile() { |
66 |
src_compile() { |
64 |
local conf |
67 |
local -a conf |
65 |
if use jit; then |
68 |
if use jit; then |
66 |
conf="-Ojit" |
69 |
conf=("-Ojit") |
67 |
else |
70 |
else |
68 |
conf="-O2" |
71 |
conf=("-O2") |
69 |
fi |
72 |
fi |
70 |
if use shadowstack; then |
73 |
if use shadowstack; then |
71 |
conf+=" --gcrootfinder=shadowstack" |
74 |
conf+=("--gcrootfinder=shadowstack") |
72 |
fi |
|
|
73 |
if use sandbox; then |
74 |
conf+=" --sandbox" |
75 |
fi |
75 |
fi |
|
|
76 |
conf+=("--make-jobs=$(makeopts_jobs)" "targetpypystandalone.py") |
76 |
|
77 |
|
77 |
conf+=" --make-jobs=$(makeopts_jobs)" |
|
|
78 |
|
79 |
conf+=" ./pypy/translator/goal/targetpypystandalone.py" |
80 |
# Avoid linking against libraries disabled by use flags |
78 |
# Avoid linking against libraries disabled by use flags |
81 |
local optional_use=("bzip2" "ncurses" "ssl") |
79 |
local optional_use=("bzip2" "ncurses" "ssl") |
82 |
local optional_mod=("bz2" "_minimal_curses" "_ssl") |
80 |
local optional_mod=("bz2" "_minimal_curses" "_ssl") |
83 |
for ((i = 0; i < ${#optional_use[*]}; i++)); do |
81 |
for ((i = 0; i < ${#optional_use[*]}; i++)); do |
84 |
if use ${optional_use[$i]}; then |
82 |
if use ${optional_use[$i]}; then |
85 |
conf+=" --withmod-${optional_mod[$i]}" |
83 |
conf+=("--withmod-${optional_mod[$i]}") |
86 |
else |
84 |
else |
87 |
conf+=" --withoutmod-${optional_mod[$i]}" |
85 |
conf+=("--withoutmod-${optional_mod[$i]}") |
88 |
fi |
86 |
fi |
89 |
done |
87 |
done |
90 |
|
88 |
|
91 |
local translate_cmd="$(PYTHON -2) ./pypy/translator/goal/translate.py --batch $conf" |
89 |
pushd pypy/translator/goal >/dev/null |
|
|
90 |
|
91 |
local translate_cmd="$(PYTHON -2) ./translate.py --batch ${conf[@]}" |
92 |
echo ${_BOLD}"${translate_cmd}"${_NORMAL} |
92 |
echo ${_BOLD}"${translate_cmd}"${_NORMAL} |
93 |
${translate_cmd} || die "compile error" |
93 |
${translate_cmd} || die "compile error" |
|
|
94 |
|
95 |
mv pypy-c ../../.. || die |
96 |
|
97 |
if use sandbox; then |
98 |
# Build a separate sandbox executable. Force -O2 instead of |
99 |
# -Ojit as upstream has "less confidence" in a binary with both |
100 |
# (pypy.org/download.html#building-from-source). Use the pypy-c |
101 |
# we just built to build the sandbox because that should be |
102 |
# faster. |
103 |
conf=("-O2" "--sandbox") |
104 |
if use shadowstack; then |
105 |
conf+=("--gcrootfinder=shadowstack") |
106 |
fi |
107 |
conf+=("--make-jobs=$(makeopts_jobs)" "targetpypystandalone.py") |
108 |
# Disable external libraries as sandboxing those is not implemented |
109 |
for ((i = 0; i < ${#optional_mod[*]}; i++)); do |
110 |
conf+=("--withoutmod-${optional_mod[$i]}") |
111 |
done |
112 |
translate_cmd="../../../pypy-c translate.py --batch ${conf[@]}" |
113 |
echo ${_BOLD}"${translate_cmd}"${_NORMAL} |
114 |
${translate_cmd} || die "sandbox compile error" |
115 |
mv pypy-c ../../../pypy-c-sandbox || die |
116 |
fi |
117 |
|
118 |
popd >/dev/null |
94 |
} |
119 |
} |
95 |
|
120 |
|
96 |
src_install() { |
121 |
src_install() { |
97 |
local INSPATH="/usr/$(get_libdir)/pypy${SLOT}" |
122 |
local INSPATH="/usr/$(get_libdir)/pypy${SLOT}" |
98 |
insinto ${INSPATH} |
123 |
insinto ${INSPATH} |
99 |
doins -r include lib_pypy lib-python pypy-c |
124 |
doins -r include lib_pypy lib-python |
100 |
fperms a+x ${INSPATH}/pypy-c |
125 |
exeinto ${INSPATH} |
|
|
126 |
doexe pypy-c |
127 |
if use sandbox; then |
128 |
doexe pypy-c-sandbox |
129 |
# pypy_interact.py is unfortunately useless without most of a |
130 |
# pypy checkout, so do not bother installing it. |
131 |
fi |
101 |
dosym ../$(get_libdir)/pypy${SLOT}/pypy-c /usr/bin/pypy-c${SLOT} |
132 |
dosym ../$(get_libdir)/pypy${SLOT}/pypy-c /usr/bin/pypy-c${SLOT} |
102 |
|
133 |
|
103 |
if ! use sqlite; then |
134 |
if ! use sqlite; then |