-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile-linux.sh
85 lines (77 loc) · 2.49 KB
/
compile-linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
#
# xTuple Build Tools
#
# DF Supply, Inc.
# 02/24/2022
#
# DO NOT USE IN PRODUCTION WITHOUT PRIOR TESTING
#
# Requires:
# RHEL 8.x or RHEL 9.x
#
# Built for RHEL 8/9 by Scott D Moore @ DF Supply - scott.moore@dfsupplyinc.com
if [[ $(id -u) -ne 0 ]]
then
echo "Please run this script as root or sudo... Exit."
exit 1
fi
if grep -q -i "Red Hat Enterprise Linux release 8" /etc/redhat-release; then
echo "running RHEL 8.x"
OS_VER="RHEL8"
elif grep -q -i "Red Hat Enterprise Linux release 9" /etc/redhat-release; then
echo "running RHEL 9.x"
OS_VER="RHEL9"
else
echo "Unsupported OS. See README for tested distributions."
OS_VER="UNSUP"
exit 1
fi
echo "xTuple Compile Utility (linux x64)"
echo "DF Supply, Inc."
echo ""
echo ""
echo "Please confirm you wish to proceed with the build? (y/n)"
read -r
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
echo "Cancelling..."
exit 1
fi
echo ""
echo "Building Qt Environment..."
if [ "$OS_VER" == "RHEL8" ]; then
subscription-manager repos --enable=codeready-builder-for-rhel-8-x86_64-rpms || exit
elif [ "$OS_VER" == "RHEL9" ]; then
subscription-manager repos --enable=codeready-builder-for-rhel-9-x86_64-rpms || exit
fi
yum install podman -y || exit
podman pull dfsbuildcontainer.azurecr.io/qt-build-env-linux:latest
podman run --name qt-build-xtuple -it -d -rm dfsbuildcontainer.azurecr.io/qt-build-env-linux:latest
# start build inside container
echo ""
echo "Qt Environment Running..."
echo "Building xTuple Client Now..."
git clone https://github.com/DFSupply/qt-client
cd qt-client || exit
git clone https://github.com/DFSupply/csvimp
git clone https://github.com/DFSupply/openrpt
cd .. || exit
podman cp qt-client qt-build-xtuple:/opt/
podman exec qt-build-xtuple bash -c "cd /opt/qt-client/openrpt/ ; qmake;"
podman exec qt-build-xtuple bash -c "cd /opt/qt-client/openrpt/ ; make -j$(nproc);"
podman exec qt-build-xtuple bash -c "cd /opt/qt-client/csvimp/ ; qmake;"
podman exec qt-build-xtuple bash -c "cd /opt/qt-client/csvimp/ ; make -j$(nproc);"
podman exec qt-build-xtuple bash -c "cd /opt/qt-client/ ; qmake;"
podman exec qt-build-xtuple bash -c "echo 'LIBS += -L/usr/local/Qt-5.15.8/lib' >> global.pri;" #hacky workaround for lib building issues
podman exec qt-build-xtuple bash -c "cd /opt/qt-client/ ; make -j$(nproc);"
echo ""
echo "Copying binary back from container..."
mkdir xTupleBuild
podman cp qt-build-xtuple:/opt/qt-client/bin/xtuple ./xTupleBuild
rm -Rf qt-client
echo ""
echo "Stopping Qt Environment"
podman stop qt-build-xtuple
echo ""
echo "Finished!"
echo ""