@@ -10,50 +10,67 @@ MANYLINUX_CFLAGS="-g -O2 -Wall -fdebug-prefix-map=/=. -fstack-protector-strong -
1010MANYLINUX_CXXFLAGS=" -g -O2 -Wall -fdebug-prefix-map=/=. -fstack-protector-strong -Wformat -Werror=format-security"
1111MANYLINUX_LDFLAGS=" -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now"
1212
13- export BASE_POLICY=manylinux
1413if [ " ${AUDITWHEEL_POLICY: 0: 10} " == " musllinux_" ]; then
1514 export BASE_POLICY=musllinux
15+ PACKAGE_MANAGER=apk
16+ else
17+ export BASE_POLICY=manylinux
18+ if command -v dnf > /dev/null 2>&1 ; then
19+ PACKAGE_MANAGER=dnf
20+ elif command -v yum > /dev/null 2>&1 ; then
21+ PACKAGE_MANAGER=yum
22+ else
23+ echo " unsupported image"
24+ exit 1
25+ fi
1626fi
1727
28+ OS_ID_LIKE=$( . /etc/os-release; echo " ${ID} ${ID_LIKE:- } " )
29+ case " ${OS_ID_LIKE} " in
30+ * rhel* ) OS_ID_LIKE=rhel;;
31+ * alpine* ) OS_ID_LIKE=alpine;;
32+ * ) echo " unsupported image" ; exit 1;;
33+ esac
34+
1835function check_var {
19- if [ -z " $1 " ]; then
20- echo " required variable not defined"
21- exit 1
22- fi
36+ if [ -z " $1 " ]; then
37+ echo " required variable not defined"
38+ exit 1
39+ fi
2340}
2441
2542
2643function fetch_source {
27- # This is called both inside and outside the build context (e.g. in Travis) to prefetch
28- # source tarballs, where curl exists (and works)
29- local file=$1
30- check_var ${file}
31- local url=$2
32- check_var ${url}
33- if [ -f ${file} ]; then
34- echo " ${file} exists, skipping fetch"
35- else
36- curl -fsSL -o ${file} ${url} /${file}
37- fi
44+ # This is called both inside and outside the build context (e.g. in Travis) to prefetch
45+ # source tarballs, where curl exists (and works)
46+ local file=$1
47+ check_var ${file}
48+ local url=$2
49+ check_var ${url}
50+ if [ -f ${file} ]; then
51+ echo " ${file} exists, skipping fetch"
52+ else
53+ curl -fsSL -o ${file} ${url} /${file}
54+ fi
3855}
3956
4057
4158function check_sha256sum {
42- local fname=$1
43- check_var ${fname}
44- local sha256=$2
45- check_var ${sha256}
46-
47- echo " ${sha256} ${fname} " > ${fname} .sha256
48- sha256sum -c ${fname} .sha256
49- rm -f ${fname} .sha256
59+ local fname=$1
60+ check_var ${fname}
61+ local sha256=$2
62+ check_var ${sha256}
63+
64+ echo " ${sha256} ${fname} " > ${fname} .sha256
65+ sha256sum -c ${fname} .sha256
66+ rm -f ${fname} .sha256
5067}
5168
5269
5370function do_standard_install {
54- ./configure " $@ " CPPFLAGS=" ${MANYLINUX_CPPFLAGS} " CFLAGS=" ${MANYLINUX_CFLAGS} " " CXXFLAGS=${MANYLINUX_CXXFLAGS} " LDFLAGS=" ${MANYLINUX_LDFLAGS} " > /dev/null
55- make > /dev/null
56- make install > /dev/null
71+ ./configure " $@ " CPPFLAGS=" ${MANYLINUX_CPPFLAGS} " CFLAGS=" ${MANYLINUX_CFLAGS} " " CXXFLAGS=${MANYLINUX_CXXFLAGS} " LDFLAGS=" ${MANYLINUX_LDFLAGS} " > /dev/null
72+ make > /dev/null
73+ make install > /dev/null
5774}
5875
5976function strip_ {
@@ -65,3 +82,41 @@ function strip_ {
6582function clean_pyc {
6683 find $1 -type f -a \( -name ' *.pyc' -o -name ' *.pyo' \) -delete
6784}
85+
86+ function manylinux_pkg_install {
87+ if [ " ${PACKAGE_MANAGER} " = " yum" ]; then
88+ yum -y install " $@ "
89+ elif [ " ${PACKAGE_MANAGER} " = " dnf" ]; then
90+ dnf -y install --allowerasing " $@ "
91+ elif [ " ${PACKAGE_MANAGER} " = " apk" ]; then
92+ apk add --no-cache " $@ "
93+ else
94+ return 1
95+ fi
96+ }
97+
98+ function manylinux_pkg_remove {
99+ if [ " ${PACKAGE_MANAGER} " = " yum" ]; then
100+ yum erase -y " $@ "
101+ elif [ " ${PACKAGE_MANAGER} " = " dnf" ]; then
102+ dnf erase -y " $@ "
103+ elif [ " ${PACKAGE_MANAGER} " = " apk" ]; then
104+ apk del " $@ "
105+ else
106+ return 1
107+ fi
108+ }
109+
110+ function manylinux_pkg_clean {
111+ if [ " ${PACKAGE_MANAGER} " = " yum" ]; then
112+ yum clean all
113+ rm -rf /var/cache/yum
114+ elif [ " ${PACKAGE_MANAGER} " = " dnf" ]; then
115+ dnf clean all
116+ rm -rf /var/cache/dnf
117+ elif [ " ${PACKAGE_MANAGER} " = " apk" ]; then
118+ :
119+ else
120+ return 1
121+ fi
122+ }
0 commit comments