aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/lin_release.yml
blob: b95453c07c4a09bff639a07e66f4cf7979f04de6 (plain) (blame)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
env:
    QT_VERSION: '5.15.2'
    TCL_VERSION: '8.6'
    SQLITE_VERSION: '3350400'
    SQLITE_RELEASE_YEAR: '2021'
    PORTABLE_DIR: ${{ github.workspace }}/output/portable/SQLiteStudio

name: Linux release build

on:
    repository_dispatch:
        types: [lin_release]

jobs:
    build:
        runs-on: ubuntu-18.04

        steps:
            - name: Cache Qt
              id: cache-qt
              uses: actions/cache@v1
              with:
                path: ${{ github.workspace }}/../Qt
                key: ${{ runner.os }}-Qt-${{ env.QT_VERSION }}-Linux-Cache
                
            - name: Install Qt
              uses: jurplel/install-qt-action@v2
              with:
                cached: ${{ steps.cache-qt.outputs.cache-hit }}
                version: ${{ env.QT_VERSION }}
                host: 'linux'
                dir: '${{ github.workspace }}/..'
                modules: 'qtscript'
                
            - name: Clone repo
              uses: actions/checkout@v2
              with:
                ref: ${{ github.event.client_payload.branch }}

            - name: Install SQLite3
              run: |
                sudo rm -f /usr/lib/libsqlite* /usr/local/lib/libsqlite* /usr/include/sqlite* /usr/local/include/sqlite* /usr/lib/x86_64-linux-gnu/libsqlite*
                wget http://sqlite.org/$SQLITE_RELEASE_YEAR/sqlite-amalgamation-$SQLITE_VERSION.zip
                unzip sqlite-amalgamation-$SQLITE_VERSION.zip
                cd sqlite-amalgamation-$SQLITE_VERSION
                gcc sqlite3.c -lpthread -ldl -lm -Os -fpic -shared -o libsqlite3.so \
                    -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
                    -DSQLITE_ENABLE_DBSTAT_VTAB \
                    -DSQLITE_ENABLE_BYTECODE_VTAB \
                    -DSQLITE_ENABLE_COLUMN_METADATA \
                    -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
                    -DSQLITE_ENABLE_FTS3 \
                    -DSQLITE_ENABLE_FTS4 \
                    -DSQLITE_ENABLE_FTS5 \
                    -DSQLITE_ENABLE_GEOPOLY \
                    -DSQLITE_ENABLE_JSON1 \
                    -DSQLITE_ENABLE_RTREE \
                    -DSQLITE_ENABLE_MATH_FUNCTIONS
                strip libsqlite3.so
                sudo cp -P libsqlite3.so* /usr/local/lib/
                sudo cp *.h /usr/local/include/

            - name: Install Tcl
              run: sudo apt-get install -qq libtcl$TCL_VERSION tcl$TCL_VERSION-dev
              
            - name: Install other tools/dependencies
              run: |
                sudo apt install libreadline-dev libncurses5-dev patchelf
                echo "${{ github.workspace }}/../Qt/${{ env.QT_VERSION }}/gcc_64/bin" >> $GITHUB_PATH
 
            - name: Prepare output dir
              run: mkdir output output/build output/build/Plugins
            
            - name: Compile SQLiteStudio3
              working-directory: output/build
              run: |
                qmake CONFIG+=portable ../../SQLiteStudio3
                make -j 2
            
            - name: Compile Plugins
              working-directory: output/build/Plugins
              run: |
                qmake CONFIG+=portable ../../../Plugins
                make -j 2
              
            - name: Prepare portable dir
              working-directory: output
              run: |
                mkdir portable
                cp -R SQLiteStudio portable/

            - name: Copy SQLite3 to portable dir
              working-directory: ${{ env.PORTABLE_DIR }}
              run: cp -P /usr/local/lib/libsqlite3.so* lib/

            - name: Copy Qt to portable dir
              working-directory: ${{ env.PORTABLE_DIR }}
              run: |
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5Core.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5DBus.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5Concurrent.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5Gui.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5Network.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5PrintSupport.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5Script.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5Widgets.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5Xml.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5Svg.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libQt5XcbQpa.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libicui18n.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libicuuc.so* lib/
                cp -P ${{ env.Qt5_Dir }}/lib/libicudata.so* lib/

            - name: Copy Qt plugins to portable dir
              working-directory: ${{ env.PORTABLE_DIR }}
              run: |
                mkdir platforms imageformats iconengines printsupport platformthemes
                cp -P ${{ env.Qt5_Dir }}/plugins/platforms/libqxcb.so platforms/libqxcb.so
                cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqgif.so imageformats/libqgif.so
                cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqicns.so imageformats/libqicns.so
                cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqico.so imageformats/libqico.so
                cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqjpeg.so imageformats/libqjpeg.so
                cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqsvg.so imageformats/libqsvg.so
                cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqtga.so imageformats/libqtga.so
                cp -P ${{ env.Qt5_Dir }}/plugins/imageformats/libqtiff.so imageformats/libqtiff.so
                cp -P ${{ env.Qt5_Dir }}/plugins/iconengines/libqsvgicon.so iconengines/libqsvgicon.so
                cp -P ${{ env.Qt5_Dir }}/plugins/printsupport/libcupsprintersupport.so printsupport/libcupsprintersupport.so
                cp -P ${{ env.Qt5_Dir }}/plugins/platformthemes/libqgtk3.so platformthemes/libqgtk3.so

            - name: Fix dependency paths
              working-directory: ${{ env.PORTABLE_DIR }}
              run: |
                chrpath -k -r \$ORIGIN/../lib   platforms/*.so imageformats/*.so iconengines/*.so printsupport/*.so platformthemes/*.so plugins/*.so 2>&1 >/dev/null
                chrpath -k -r \$ORIGIN          lib/libcoreSQLiteStudio.so lib/libguiSQLiteStudio.so 2>&1 >/dev/null
                chrpath -k -r \$ORIGIN/lib      sqlitestudio 2>&1 >/dev/null
                chrpath -k -r \$ORIGIN/lib      sqlitestudiocli 2>&1 >/dev/null
                chrpath -l platforms/*.so imageformats/*.so iconengines/*.so printsupport/*.so platformthemes/*.so plugins/*.so
                chrpath -l lib/libcoreSQLiteStudio.so lib/libguiSQLiteStudio.so
                chrpath -l sqlitestudio
                chrpath -l sqlitestudiocli

            - name: Final preparations for packaging
              working-directory: ${{ env.PORTABLE_DIR }}
              run: |
                cp `ldd sqlitestudiocli | grep readline | awk '{print $3}'` lib/
                cp `ldd lib/libreadline* | grep tinfo | awk '{print $3}'` lib/
                strip lib/*.so sqlitestudio sqlitestudiocli platforms/*.so imageformats/*.so iconengines/*.so printsupport/*.so platformthemes/*.so plugins/*.so
                patchelf --set-rpath '$ORIGIN' lib/libreadline*

            - name: Determine SQLiteStudio version
              working-directory: ${{ env.PORTABLE_DIR }}
              run: echo "SQLITESTUDIO_VERSION=$(./sqlitestudiocli --version | cut -f 2 -d ' ')" >> $GITHUB_ENV

            - name: Assemble portable package
              shell: bash
              working-directory: ${{ env.PORTABLE_DIR }}/..
              run: |
                tar cf sqlitestudio-$SQLITESTUDIO_VERSION.tar SQLiteStudio
                xz -z sqlitestudio-$SQLITESTUDIO_VERSION.tar
                pwd
                ls -l

            - name: Upload package artifact
              uses: actions/upload-artifact@v1
              with:
                name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.tar.xz
                path: output/portable/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.tar.xz