=license

	Copyright © 2018 Yang Bo

	This file is part of RSLinux.

	RSLinux is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	RSLinux is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with RSLinux.  If not, see <http://www.gnu.org/licenses/>.

=cut
sub {
	my $s = shift;
	my ($l, $r) = ("prefix=$s->{prefix}", "PREFIX=$s->{prefix}");
	{glibc => {switch => ['--enable-obsolete-rpc'],
		   'separate-build' => 1},
	 gmp => {'post-make' => 'make check'},
	 mpfr => 'gmp',
	 mpc => 'gmp',
	 gcc => {switch => [qw/--enable-languages=c,c++ --disable-multilib/],
		 'separate-build' => 1},
	 ncurses => {switch => [qw/--with-shared --without-debug/]},
	 ncursesw => {switch => ["--includedir=$s->{prefix}/include/ncursesw", qw|--with-shared --enable-widec --disable-db-install --without-manpages --without-progs --without-debug|]},
	 bash => {switch => [qw/--with-curses/]},
	 perl => {'no-configure' => 1,
		      'post-configure' => $s->{bootstrap} ? "./Configure -Dcc=gcc -de -D$l -Accflags=-I$s->{prefix}/include -Aldflags=\"-L$s->{prefix}/lib -Wl,-I" . linker($s) . '"' : "./Configure -Dcc=gcc -de -D$l",
		      'post-make' => $s->{bootstrap} ? undef : 'make test'},
	 bzip2 => {'no-configure' => 1,
		       'make-install-parameter' => [$r]},
	 zlib => {environment => $s->{bootstrap} ? {CFLAGS => "-I$s->{prefix}/include"} : undef},
	 gettext => {switch => [$s->{bootstrap} ? '--with-included-libxml' : ()]},
	 'man-db' => {switch => [qw/--disable-setuid/]},
	 openssl => {'no-configure' => 1,
			 'post-configure' => './config --prefix=/usr --openssldir=/share/openssl shared',
			 'post-make' => 'make test'},
	 'git-no-doc' => {'no-configure' => 1,
			      'make-parameter' => [$l],
			      'make-install-parameter' => [$l]},
	 libxml2 => {'post-make' => 'make tests'},
	 python => {switch => [qw/--enable-shared --enable-optimizations/]},
	 'util-linux' => {'pre-configure' => './autogen.sh'},
	 procps => 'util-linux',
	 curl => {'pre-configure' => './buildconf'},
	 iproute2 => {'make-install-parameter' => ["DESTDIR=$s->{prefix}"]},
	 screen => 'util-linux',
	 wget => {switch => [qw/--with-ssl=openssl/]},
	 'man-pages' => {'no-configure' => 1,
			     'no-make' => 1},
	 kmod => {'post-make-install' => <<'EOF'},
for i in lsmod modprobe depmod modinfo insmod rmmod; do
	ln -s /bin/kmod /sbin/$i
done
EOF
	 kbd => {'pre-configure' => './autogen.sh',
		     switch => [qw/--disable-vlock/]},
	 lynx => {switch => [qw/--with-ssl --with-screen=ncursesw/],
		  'post-make-install' => <<'EOF'},
make install-help
make install-doc
EOF
	 sysvinit => {'no-configure' => 1},
	 emacs => {switch => [qw/--without-x --with-file-notification=inotify/]},
	 syslinux => {'no-configure' => 1,
			  'make-parameter' => [qw/bios/],
			  'make-install-parameter' => ['bios', "INSTALLROOT=$s->{prefix}"]},
	 pixman => 'gmp',
	 glib => {'pre-configure' => 'NOCONFIGURE=1 ./autogen.sh',
		      switch => [qw/--with-pcre=internal --enable-static=yes/]},
	 harfbuzz => {'pre-configure' => 'NOCONFIGURE=1 ./autogen.sh'},
	 freetype => 'util-linux',
	 cairo => 'harfbuzz',
	 mesa => {switch => [qw/--with-egl-platforms=x11,drm --with-dri-drivers=i965 --with-gallium-drivers=nouveau --enable-gbm --enable-shared-glapi --enable-glx-tls/]},
	 strace => {'pre-configure' => './bootstrap'},
	 libuv => 'util-linux',
	 'gobject-introspection' => 'harfbuzz',
	 zip => {'no-configure' => 1,
		     'make-parameter' => [qw|generic_gcc -f unix/Makefile|],
		     'make-install-parameter' => [$l, qw|-f unix/Makefile|]},
	 unzip => {'no-configure' => 1,
		       'make-parameter' => [qw|generic -f unix/Makefile|],
		       'make-install-parameter' => [$l, qw|-f unix/Makefile|]},
	 'gdk-pixbuf' => 'harfbuzz',
	 'gtk+' => 'harfbuzz',
	 'atk' => 'harfbuzz',
	 'pango' => 'harfbuzz',
	 'XML-Parser' => {'no-configure' => 1,
			      'post-configure' => 'perl Makefile.PL',
			      'post-make' => 'make test'},
	 'terminus-font' => {switch => [qw|--x11dir=/share/fonts/X11/terminus|]},
	 x264 => {switch => [qw/--enable-static --enable-shared/]},
	 ffmpeg => {switch => [qw/--enable-gpl --enable-nonfree --enable-libass --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libx264 --enable-libx265 --enable-shared --enable-openssl/]},
	 libpng => {environment => {LIBS => '-lpthread'}},
	 wireshark => {switch => [qw/--with-gtk2 --enable-setuid-install --with-ssl/]},
	 qemu => {switch => [qw/--audio-drv-list=alsa/]},
	 qt5 => {'no-configure' => 1,
		     'post-configure' => './configure -prefix /lib/qt5 -release -opensource -confirm-license -nomake tests -nomake examples -no-dbus'},
	 mutt => {switch => [qw/--enable-hcache --with-ssl --enable-imap/]},
	 bc => {switch => ['--with-readline']},
	 'poppler-data' => {'no-configure' => 1,
				'no-make' => 1,
				'make-install-parameter' => [$l]},
	 luajit => {'no-configure' => 1,
			'make-parameter' => [$r],
			'make-install-parameter' => [$r]},
	 libtirpc => {switch => ['--disable-gssapi']},
	 rpcbind => {switch => ['--without-systemdsystemunitdir']},
	 'nfs-utils' => {switch => [qw/--disable-gss --disable-nfsv4 --without-tcp-wrappers/]},
	 git => {'make-parameter' => [qw/all doc/],
		     'make-install-parameter' => [qw/install-doc install-html/]},
	 pciutils => {'no-configure' => 1,
			  'make-parameter' => [$r],
			  'make-install-parameter' => [$r]},
	 librsvg => 'harfbuzz',
	 gimp => {'pre-configure' => 'NOCONFIGURE=1 ./autogen.sh',
		      switch => [qw'--disable-python --without-gvfs']},
	 samba => {switch => [qw|--enable-fhs --sysconfdir=/etc --localstatedir=/var --without-ad-dc --without-acl-support --without-ldap --without-ads|]},
	 fftw => {switch => [qw/--enable-shared --enable-threads/]},
	 squid => {'pre-configure' => './bootstrap.sh',
		       switch => [qw/--with-openssl --enable-ssl-crtd/]},
	 pcre => {switch => [qw/--enable-jit --enable-utf --enable-unicode-properties --enable-newline-is-any --enable-pcregrep-libz --enable-pcretest-libreadline/],
		  'post-make' => 'make check'},
	 dialog => {switch => [qw/--with-ncursesw --enable-nls --with-shared/]},
	 'pkg-config' => {switch => [qw/--with-internal-glib/]}};
};