[export]
SRC      = /tmp/work/src
PKG      = /tmp/work/pkg
SOURCES_DIR = /sources
CARCH    = "x86_64"
CHOST    = "x86_64-pc-linux-gnu"
CPPFLAGS = "-D_FORTIFY_SOURCE=2"
CFLAGS   = "-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
CXXFLAGS = "-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
LDFLAGS  = "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
MAKEJOBS = "-j$((`nproc`+1))"
CONF_OPT = --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib \
			--bindir=/usr/bin --sbindir=/usr/bin --sysconfdir=/etc \
			--mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share \
			--localstatedir=/var --disable-static
CMAKE_OPT= -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib
M4       = m4

[files]
compress = opt,tools,boot,usr,etc,var,.icbilgi,.meta
invalid  = bin,sbin,lib,lib64,usr/sbin,usr/lib64
delete   = usr/share/man,usr/share/info,usr/share/doc,usr/share/gtk-doc,usr/lib/systemd,var/run
;strip    = true
;nostrip  = usr/lib/x.so

[source]
xz     = {{.}}/$isim-$surum.tar.xz
gz     = {{.}}/$isim-$surum.tar.gz
bz2    = {{.}}/$isim-$surum.tar.bz2
zip    = {{.}}/$isim-$surum.zip
github = https://github.com/{{.}}/archive/v${surum}.tar.gz

[build]
ekconf = export EXT_OPT="{{.}}"
betik  = {{.}}
dosya  = bash ${TDIR}/{{.}}
tip    = build_type
jobs   = "export MAKEJOBS=-j{{.}}"
noflag = export CFLAGS="" && export CPPFLAGS="" && export LDFLAGS="" && export CXXFLAGS="";
bayrak = %(noflag)s
patch  = patch -Np1 -i $SRC/{{.}}
yama   = %(patch)s
export = export {{.}}
meson  = "cd $SRC && milis-meson ${EXT_OPT} {{.}} build-{{.}} && meson compile -C build-{{.}} && meson install -C build-{{.}} --destdir $PKG && unset EXT_OPT"
gnu    = "cd $SRC/{{.}} && ./configure ${CONF_OPT} ${EXT_OPT} && make ${MAKEJOBS} && make DESTDIR=$PKG install && unset EXT_OPT"
py     = "cd $SRC/{{.}} && python3 setup.py build ${EXT_OPT} && python3 setup.py install --root=${PKG} --optimize=1 && unset EXT_OPT"

[build_type]
autogen = ./autogen.sh && ./configure ${CONF_OPT} ${EXT_OPT} && make ${MAKEJOBS}
gnu   = ./configure ${CONF_OPT} ${EXT_OPT} && make ${MAKEJOBS}
cmake = mkdir -p build && cd build && cmake ${CMAKE_OPT} ${EXT_OPT} ../ && make ${MAKEJOBS}
py3   = python3 setup.py build
py2   = python2 setup.py build
perl  = perl Makefile.PL INSTALLDIRS=vendor && make
meson = cd $SRC && meson setup --prefix /usr --libexecdir lib --sbindir bin --buildtype plain --auto-features \
        enabled --wrap-mode nodownload -D b_lto=true -D b_pie=true ${SRC_DIR} build ${EXT_OPT}
ninja = mkdir -p build && ninja -C build
waf   = python3 waf configure --prefix=/usr ${EXT_OPT} && python3 waf build
qmake = qmake-qt5 CONFIG+=release PREFIX=/usr ${EXT_OPT} && make ${MAKEJOBS}
go    = go build -o $isim

[install]
ekconf = export EXT_OPT={{.}}
betik  = {{.}}
tip    = install_type
dosya  = bash ${TDIR}/{{.}}
nostrip= touch $PKG/nostrip

[install_type]
gnu   = make DESTDIR=$PKG install $EXT_OPT
cmake = cd build && make DESTDIR=$PKG install
py3   = python3 setup.py install --root=${PKG} --optimize=1 --skip-build $EXT_OPT
py2   = python2 setup.py install --root=${PKG} --optimize=1 --skip-build $EXT_OPT
ninja = DESTDIR=$PKG ninja -C build install
meson = cd $SRC && DESTDIR=$PKG ninja -C build install
waf   = python3 waf install --destdir=$PKG
bin   = install -Dm755 $isim -t $PKG/usr/bin/
qmake = make INSTALL_ROOT=${PKG} install && [ -d $PKG/usr/lib ] \
        && find $PKG/usr/lib -type f -name '*.prl' -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
        
[source_site]
KERNEL_SITE      = "https://www.kernel.org/pub/linux/"
GNU_SITE         = "https://ftp.gnu.org/gnu/"
GNOME_SITE       = "https://download.gnome.org/sources"
PYPI_SITE        = "https://files.pythonhosted.org/packages/source"
XFCE4_SITE       = "https://archive.xfce.org/src"
CPAN_SITE        = "https://www.cpan.org/modules/by-module"
SOURCEFORGE_SITE = "https://downloads.sourceforge.net/sourceforge"
FREEDESKTOP_SITE = "https://www.freedesktop.org/software/"
DEBIAN_SITE      = "http://ftp.debian.org/debian/pool/"
KDE_SITE         = "https://download.kde.org/stable/"
XORG_SITE        = "https://www.x.org/releases/individual"
