# IUP-stack

Стек библиотеки IUP

## Download

```sh
wget https://sourceforge.net/projects/imtoolkit/files/3.15/Docs%20and%20Sources/im-3.15_Sources.tar.gz
wget https://sourceforge.net/projects/canvasdraw/files/5.14/Docs%20and%20Sources/ftgl-2.1.5_Sources.tar.gz
wget https://sourceforge.net/projects/canvasdraw/files/5.14/Docs%20and%20Sources/freetype-2.10.2_Sources.tar.gz
wget https://sourceforge.net/projects/canvasdraw/files/5.14/Docs%20and%20Sources/pdflib_lite-7.0.5_Sources.tar.gz
wget https://sourceforge.net/projects/canvasdraw/files/5.14/Docs%20and%20Sources/cd-5.14_Sources.tar.gz
wget https://sourceforge.net/projects/iup/files/3.30/Docs%20and%20Sources/iup-3.30_Sources.tar.gz
wget https://www.lua.org/ftp/lua-5.4.4.tar.gz
```

## Сборка

Экспорт переменных, где `/root/iup/` путь к репозиторию, а `Linux62_64` релиз ядра (возможен другой путь после компиляции):

```sh
export USE_GTK3=Yes
export USE_PKGCONFIG=Yes
export USE_LUA_VERSION=54
export USE_LUA54=Yes
export LUA_LIB=/root/iup/lua-5.4.4/src
export LUA_INC=/root/iup/lua-5.4.4/src
export IM_LIB=/root/iup/im/lib/Linux62_64
export IM_INC=/root/iup/im/include
export FTGL_LIB=/root/iup/ftgl/lib/Linux62_64
export FTGL_INC=/root/iup/ftgl/include
export PDFLIB_LIB=/root/iup/pdflib7/lib/Linux62_64
export PDFLIB_INC=/root/iup/pdflib7/include
export CD_LIB=/root/iup/cd/lib/Linux62_64
export CD_INC=/root/iup/cd/include
```

### lua

```sh
cd lua-5.4.4
make linux
ln -s liblua.a src/liblua54.a
```

Для компиляции из под Lua 5.4 необходимо создать ссылки:

```sh
mkdir -p /root/iup/lua54/bin/Linux62_64
ln -sf $LUA_LIB/lua /root/iup/lua54/bin/Linux62_64/lua54
```

### pdflib7

```sh
cd pdflib7
make
```

### ftgl

```sh
cd ftgl
make
```

### fftw

Библиотеку необходимо собрать [2 раза](https://www.linuxfromscratch.org/blfs/view/stable-systemd/general/fftw.html) - для одинарной точности и двойной точности (`--enable-sse`, `--enable-float`)

```sh
cd fftw
./configure --enable-shared --enable-sse --prefix=/usr
make -j16
make install
make clean
./configure --enable-shared --enable-float --prefix=/usr
make -j16
make install
```

### im

```sh
cd im
make
```

### cd

```sh
cd cd
make
```

### iup

Применить патч для ядра Linux v6:

```sh
cd iup
patch -p1 < without-lua-prefix-with-linux6.patch
make
```

### Сборка одним скриптом

Где `<kernel>`:
- `Linux515_64`
- `Linux62_64`

```sh
./build.sh <kernel>
```
