Skip to content

Commit

Permalink
Merge pull request #672 from wazuh/669-add-gcc5-support
Browse files Browse the repository at this point in the history
Add GCC5 support to Manager build with Python 3.9
  • Loading branch information
davidjiglesias authored Mar 19, 2021
2 parents 2cb7087 + 942b93c commit 88daf71
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 5 deletions.
12 changes: 12 additions & 0 deletions debs/Debian/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ RUN apt-get update && apt-get build-dep python3.2 -y && \
RUN sed -i 's:https:http:g' /etc/apt/sources.list.d/nodesource.list && \
apt-get update && apt-get install nodejs -y

RUN curl -OL http://packages.wazuh.com/utils/gcc/gcc-5.5.0.tar.gz && \
tar xzf gcc-5.5.0.tar.gz && cd gcc-5.5.0/ && \
./contrib/download_prerequisites && \
./configure --prefix=/usr/local/gcc-5.5.0 --enable-languages=c,c++ --disable-multilib \
--disable-libsanitizer --disable-bootstrap && \
make -j$(nproc) && make install && \
ln -fs /usr/local/gcc-5.5.0/bin/g++ /usr/bin/c++ && cd / && rm -rf gcc-*

ENV CPLUS_INCLUDE_PATH "/usr/local/gcc-5.5.0/include/c++/5.5.0/"
ENV LD_LIBRARY_PATH "/usr/local/gcc-5.5.0/lib64:${LD_LIBRARY_PATH}"
ENV PATH "/usr/local/gcc-5.5.0/bin:${PATH}"

# Add the script to build the Debian package
ADD build.sh /usr/local/bin/build_package
RUN chmod +x /usr/local/bin/build_package
Expand Down
10 changes: 6 additions & 4 deletions debs/SPECS/4.1.3/wazuh-manager/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export INSTALLATION_DIR="/var/ossec"
export INSTALLATION_SCRIPTS_DIR="${INSTALLATION_DIR}/packages_files/manager_installation_scripts"
export JOBS="5"
export DEBUG_ENABLED="no"
export PATH="${PATH}"
export LD_LIBRARY_PATH=""

%:
dh $@
Expand Down Expand Up @@ -184,11 +186,11 @@ override_dh_install:
override_dh_fixperms:
dh_fixperms
# Fix Python permissions
chmod 0750 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/bin/2to3-3.8
chmod 0750 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/bin/pydoc3.8
chmod 0750 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/bin/2to3-3.9
chmod 0750 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/bin/pydoc3.9
chmod 0750 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/bin/python3-config
chmod 0640 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/lib/pkgconfig/python-3.8-embed.pc
chmod 0640 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/lib/pkgconfig/python-3.8.pc
chmod 0640 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/lib/pkgconfig/python-3.9-embed.pc
chmod 0640 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/lib/pkgconfig/python-3.9.pc
chmod 0640 ${TARGET_DIR}$(INSTALLATION_DIR)/framework/python/lib/pkgconfig/python3.pc

override_dh_auto_clean:
Expand Down
2 changes: 2 additions & 0 deletions debs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ cd ${build_dir}/${build_target} && tar -czf ${package_full_name}.orig.tar.gz "${
sed -i "s:RELEASE:${package_release}:g" ${sources_dir}/debian/changelog
sed -i "s:export JOBS=.*:export JOBS=${jobs}:g" ${sources_dir}/debian/rules
sed -i "s:export DEBUG_ENABLED=.*:export DEBUG_ENABLED=${debug}:g" ${sources_dir}/debian/rules
sed -i "s#export PATH=.*#export PATH=/usr/local/gcc-5.5.0/bin:${PATH}#g" ${sources_dir}/debian/rules
sed -i "s#export LD_LIBRARY_PATH=.*#export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}#g" ${sources_dir}/debian/rules
sed -i "s:export INSTALLATION_DIR=.*:export INSTALLATION_DIR=${dir_path}:g" ${sources_dir}/debian/rules
sed -i "s:DIR=\"/var/ossec\":DIR=\"${dir_path}\":g" ${sources_dir}/debian/{preinst,postinst,prerm,postrm}
if [ "${build_target}" == "api" ]; then
Expand Down
12 changes: 12 additions & 0 deletions rpms/CentOS/6/x86_64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ RUN mkdir -p /usr/local/var/lib/rpm && \
cp /var/lib/rpm/Packages /usr/local/var/lib/rpm/Packages && \
/usr/local/bin/rpm --rebuilddb && rm -rf /root/rpmbuild

RUN curl -OL http://packages.wazuh.com/utils/gcc/gcc-5.5.0.tar.gz && \
tar xzf gcc-5.5.0.tar.gz && cd gcc-5.5.0/ && \
./contrib/download_prerequisites && \
./configure --prefix=/usr/local/gcc-5.5.0 --enable-languages=c,c++ \
--disable-multilib --disable-libsanitizer --disable-bootstrap && \
make -j$(nproc) && make install && \
ln -fs /usr/local/gcc-5.5.0/bin/g++ /usr/bin/c++ && cd / && rm -rf gcc-*

ENV CPLUS_INCLUDE_PATH "/usr/local/gcc-5.5.0/include/c++/5.5.0/"
ENV LD_LIBRARY_PATH "/usr/local/gcc-5.5.0/lib64/"
ENV PATH "/usr/local/gcc-5.5.0/bin:${PATH}"

# Add the scripts to build the RPM package
ADD build.sh /usr/local/bin/build_package
RUN chmod +x /usr/local/bin/build_package
Expand Down
12 changes: 12 additions & 0 deletions rpms/CentOS/7/aarch64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ RUN yum install -y gcc make wget git \
redhat-rpm-config sqlite-devel gdb tar tcl-devel tix-devel tk-devel \
valgrind-devel python-rpm-macros python34 nodejs

RUN curl -OL http://packages.wazuh.com/utils/gcc/gcc-5.5.0.tar.gz && \
tar xzf gcc-5.5.0.tar.gz && cd gcc-5.5.0/ && \
./contrib/download_prerequisites && \
./configure --prefix=/usr/local/gcc-5.5.0 --enable-languages=c,c++ --disable-multilib \
--disable-libsanitizer --disable-bootstrap && \
make -j$(nproc) && make install && \
ln -fs /usr/local/gcc-5.5.0/bin/g++ /usr/bin/c++ && cd / && rm -rf gcc-*

ENV CPLUS_INCLUDE_PATH "/usr/local/gcc-5.5.0/include/c++/5.5.0/"
ENV LD_LIBRARY_PATH "/usr/local/gcc-5.5.0/lib64/"
ENV PATH "/usr/local/gcc-5.5.0/bin:${PATH}"

RUN curl -O http://packages.wazuh.com/utils/openssl/openssl-1.1.1a.tar.gz && \
tar -xzf openssl-1.1.1a.tar.gz && cd openssl* && \
./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' && \
Expand Down
12 changes: 12 additions & 0 deletions rpms/CentOS/7/ppc64le/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ RUN yum install -y \
http://packages.wazuh.com/utils/nodejs/npm-5.6.0-1.8.9.4.2.el7.ppc64le.rpm \
http://packages.wazuh.com/utils/nodejs/nodejs-debuginfo-8.9.4-2.el7.ppc64le.rpm

RUN curl -OL http://packages.wazuh.com/utils/gcc/gcc-5.5.0.tar.gz && \
tar xzf gcc-5.5.0.tar.gz && cd gcc-5.5.0/ && \
./contrib/download_prerequisites && \
./configure --prefix=/usr/local/gcc-5.5.0 --enable-languages=c,c++ \
--disable-multilib --disable-libsanitizer --disable-bootstrap && \
make -j$(nproc) && make install && \
ln -fs /usr/local/gcc-5.5.0/bin/g++ /usr/bin/c++ && cd / && rm -rf gcc-*

ENV CPLUS_INCLUDE_PATH "/usr/local/gcc-5.5.0/include/c++/5.5.0/"
ENV LD_LIBRARY_PATH "/usr/local/gcc-5.5.0/lib64/"
ENV PATH "/usr/local/gcc-5.5.0/bin:${PATH}"

# Add the scripts to build the RPM package
ADD build.sh /usr/local/bin/build_package
RUN chmod +x /usr/local/bin/build_package
Expand Down
2 changes: 1 addition & 1 deletion rpms/SPECS/4.1.3/wazuh-manager-4.1.3.spec
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ rm -fr %{buildroot}
%attr(750, root, ossec) %{_localstatedir}/integrations/*
%dir %attr(750, root, ossec) %{_localstatedir}/lib
%attr(750, root, ossec) %{_localstatedir}/lib/libwazuhext.so
%{_localstatedir}/lib/libpython3.8.so.1.0
%{_localstatedir}/lib/libpython3.9.so.1.0
%dir %attr(770, ossec, ossec) %{_localstatedir}/logs
%attr(660, ossec, ossec) %ghost %{_localstatedir}/logs/active-responses.log
%attr(660, ossec, ossec) %ghost %{_localstatedir}/logs/api.log
Expand Down

0 comments on commit 88daf71

Please sign in to comment.