Server-Root/libraries/build_jemalloc.sh

44 lines
1.3 KiB
Bash
Raw Normal View History

2018-08-25 10:42:06 -04:00
#!/bin/bash
cd jemalloc/
if ! [ -f configure ]; then
autoconf
2018-08-25 10:48:42 -04:00
if [ $? -ne 0 ]; then
echo "Failed to create configure file"
exit 1
fi
if ! [ -f configure ]; then
2018-08-25 10:42:06 -04:00
echo "Failed to create configure file"
exit 1
fi
fi
cd build
2019-05-27 13:01:09 -04:00
../configure --enable-munmap
2018-08-25 10:42:06 -04:00
if [ $? -ne 0 ]; then
echo "Failed to create makefile"
exit 1
fi
(cat Makefile | sed 's/.*$(CC) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS).*/ $(CXX) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS)/') > tmp
rm Makefile
mv tmp Makefile
make -j 12 LIBS="-pthread -static-libgcc -static-libstdc++ -fPIC" CFLAGS="-static-libgcc -static-libstdc++ -fPIC" CXXFLAGS="-static-libgcc -static-libstdc++ -fPIC"
#make -j 12 LIBS="-pthread -static-libgcc -static-libstdc++" CFLAGS="-fPIC" CXXFLAGS="-fPIC"
#make -j 12 LIBS="-pthread -lm -l/usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.a" ${MAKE_OPTIONS} CFLAGS="-shared -static-libstdc++ -static-libgcc -fPIC" CXXFLAGS="-static-libstdc++ -static-libgcc -shared -fPIC"
if [ $? -ne 0 ]; then
echo "Failed to build jemalloc"
exit 1
fi
2018-11-17 11:16:40 -05:00
2018-08-25 10:42:06 -04:00
sudo make install &>/dev/null
if [ $? -ne 0 ]; then #Workaround because the install fails
exit 0
fi
2018-11-17 11:16:40 -05:00
#make -j 12 LIBS="-pthread -static-libgcc -static-libstdc++" CFLAGS="-fPIC" CXXFLAGS="-fPIC"