Как установить gtk3 и gedit3 в системе Linux без библиотек gtk3 и без пароля root...
Просто отдаю это, потому что это пустая трата времени, но может быть полезно для кого-то... кто знает:
ОТКАЗ ОТ ОТВЕТСТВЕННОСТИ: если это снова сломается, потому что у него слишком много зависимостей, просто запустите его через AI несколько раз, чтобы исправить это:
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
use File::Path qw(make_path);
use Getopt::Long;
my ($force_rebuild, $clean_markers) = (0, 0);
GetOptions('force' => \$force_rebuild, 'clean-markers' => \$clean_markers)
or die "Usage: $0 [--force] [--clean-markers]\n";
my $install_dir = "$ENV{HOME}/local";
my $build_dir = "$ENV{HOME}/gtk3_build_temp";
my $marker_dir = "$build_dir/.build_markers";
my ($meson_bin, $ninja_bin) = ("$ENV{HOME}/.local/bin/meson", "$ENV{HOME}/.local/bin/ninja");
make_path($install_dir, $build_dir, $marker_dir) unless -d $marker_dir;
if ($clean_markers) {
system("rm -f $marker_dir/*");
print "Markers cleaned. Packages will rebuild on next run.\n";
exit 0;
}
# Generate X11 libs programmatically
sub x11_libs {
my @x11 = (
['util-macros', 'https://www.x.org/archive/individual/ut ... .3.tar.bz2'],
['xorgproto', 'https://xorg.freedesktop.org/archive/in ... .5.tar.bz2'],
['libXau', 'https://www.x.org/archive/individual/li ... .11.tar.gz'],
['libXdmcp', 'https://www.x.org/archive/individual/li ... 1.4.tar.gz'],
['xcb-proto', 'https://xorg.freedesktop.org/archive/in ... 5.2.tar.xz'],
['libpthread-stubs', 'https://xcb.freedesktop.org/dist/libpth ... 0.4.tar.gz'],
['libxcb', 'https://www.x.org/archive/individual/li ... .15.tar.xz'],
['xtrans', 'https://www.x.org/archive/individual/li ... 4.0.tar.gz'],
['libX11', 'https://www.x.org/archive/individual/li ... 8.4.tar.gz'],
['libXext', 'https://www.x.org/archive/individual/li ... 3.5.tar.gz'],
['libXrender', 'https://www.x.org/archive/individual/li ... .11.tar.gz'],
['libXfixes', 'https://www.x.org/archive/individual/li ... 0.0.tar.gz'],
['libXrandr', 'https://www.x.org/archive/individual/li ... 5.3.tar.gz'],
['libXi', 'https://www.x.org/archive/individual/li ... 1.8.tar.gz'],
['libXcursor', 'https://www.x.org/archive/individual/li ... 2.1.tar.gz'],
['libXdamage', 'https://www.x.org/archive/individual/li ... 1.6.tar.gz'],
['libXcomposite', 'https://www.x.org/archive/individual/li ... 4.6.tar.gz'],
['libXinerama', 'https://www.x.org/archive/individual/li ... 1.5.tar.gz'],
['libXtst', 'https://www.x.org/archive/individual/li ... 2.4.tar.gz'],
);
return map { {name => $_->[0], url => $_->[1], build_with_meson => 0} } @x11;
}
my @dependencies = (
{name => 'pkg-config', url => 'https://pkgconfig.freedesktop.org/relea ... 9.2.tar.gz',
build_with_meson => 0, configure_options => ['--with-internal-glib']},
{name => 'bison', url => 'https://mirrors.kernel.org/gnu/bison/bison-3.8.2.tar.xz', build_with_meson => 0},
{name => 'cmake', url => 'https://github.com/Kitware/CMake/releas ... 2.1.tar.gz',
build_with_meson => 0, configure_options => ['--parallel=' . (`nproc 2>/dev/null` || 4)]},
{name => 'zlib', url => 'https://github.com/madler/zlib/releases ... .13.tar.gz', build_with_meson => 0},
{name => 'libffi', url => 'https://github.com/libffi/libffi/releas ... 4.4.tar.gz', build_with_meson => 0},
{name => 'pcre', url => 'https://sourceforge.net/projects/pcre/f ... z/download',
build_with_meson => 0, configure_options => ['--enable-unicode-properties', '--enable-pcre16', '--enable-pcre32']},
{name => 'glib', url => 'https://download.gnome.org/sources/glib ... 0.0.tar.xz',
build_with_meson => 1, meson_options => ['-Dlibmount=disabled', '--wrap-mode=nofallback']},
{name => 'gobject-introspection', url => 'https://download.gnome.org/sources/gobj ... 2.0.tar.xz',
build_with_meson => 1, meson_options => ['-Ddoctool=disabled', '-Dcairo=disabled', '--wrap-mode=nofallback']},
{name => 'libpng', url => 'https://sourceforge.net/projects/libpng ... z/download',
build_with_meson => 0, configure_options => ['--enable-shared', '--enable-static']},
{name => 'libjpeg-turbo', url => 'https://github.com/libjpeg-turbo/libjpe ... 1.4.tar.gz',
build_with_meson => 0, build_with_cmake => 1, configure_options => ['-DWITH_JPEG8=ON']},
{name => 'libxml2', url => 'https://download.gnome.org/sources/libx ... .14.tar.xz',
build_with_meson => 0, configure_options => ['--without-python', '--without-lzma']},
{name => 'shared-mime-info', url => 'https://gitlab.freedesktop.org/xdg/shar ... 2.2.tar.gz',
build_with_meson => 1, meson_options => ['-Dupdate-mimedb=false']},
{name => 'gdk-pixbuf', url => 'https://download.gnome.org/sources/gdk- ... 2.6.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false', '-Dman=false', '-Dinstalled_tests=false', '-Dbuiltin_loaders=none']},
x11_libs(), # Insert all X11 libraries
{name => 'pixman', url => 'https://cairographics.org/releases/pixman-0.40.0.tar.gz', build_with_meson => 0},
{name => 'freetype', url => 'https://download.savannah.gnu.org/relea ... 1.0.tar.xz',
build_with_meson => 0, configure_options => ['--enable-freetype-config']},
{name => 'fontconfig', url => 'https://www.freedesktop.org/software/fo ... .94.tar.xz', build_with_meson => 0},
{name => 'cairo', url => 'https://cairographics.org/releases/cairo-1.16.0.tar.xz', build_with_meson => 0},
{name => 'harfbuzz', url => 'https://github.com/harfbuzz/harfbuzz/re ... 0.0.tar.xz', build_with_meson => 1},
{name => 'fribidi', url => 'https://github.com/fribidi/fribidi/rele ... .11.tar.xz', build_with_meson => 1},
{name => 'pango', url => 'https://download.gnome.org/sources/pang ... .10.tar.xz', build_with_meson => 1},
{name => 'atk', url => 'https://download.gnome.org/sources/atk/ ... 6.0.tar.xz', build_with_meson => 1},
{name => 'expat', url => 'https://github.com/libexpat/libexpat/re ... 5.0.tar.xz',
build_with_meson => 0, configure_options => ['--without-docbook']},
{name => 'dbus', url => 'https://dbus.freedesktop.org/releases/d ... 4.4.tar.xz',
build_with_meson => 0, configure_options => ['--disable-systemd', '--disable-tests']},
{name => 'at-spi2-core', url => 'https://download.gnome.org/sources/at-s ... 2.0.tar.xz',
build_with_meson => 1, meson_options => ['-Ddocs=false', '-Dx11=yes']},
{name => 'at-spi2-atk', url => 'https://download.gnome.org/sources/at-s ... 8.0.tar.xz', build_with_meson => 1},
{name => 'libepoxy', url => 'https://download.gnome.org/sources/libe ... .10.tar.xz', build_with_meson => 1},
{name => 'gtk+', url => 'https://download.gnome.org/sources/gtk+ ... .43.tar.xz',
build_with_meson => 1, meson_options => ['-Dx11_backend=true', '-Dwayland_backend=false', '-Dintrospection=true']},
{name => 'gtksourceview', url => 'https://download.gnome.org/sources/gtks ... 8.2.tar.xz',
build_with_meson => 1, meson_options => ['-Dgir=true', '-Dvapi=false']},
{name => 'pygobject', url => 'https://download.gnome.org/sources/pygo ... 2.0.tar.xz', build_with_meson => 1},
{name => 'gsettings-desktop-schemas', url => 'https://download.gnome.org/sources/gset ... 1.0.tar.xz',
build_with_meson => 1},
{name => 'libpeas', url => 'https://download.gnome.org/sources/libp ... 2.0.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false', '-Dvapi=false', '-Ddemos=false', '-Dintrospection=true', '--wrap-mode=nofallback']},
{name => 'amtk', url => 'https://download.gnome.org/sources/amtk ... 3.1.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false']},
{name => 'icu', url => 'https://github.com/unicode-org/icu/rele ... _1-src.tgz',
build_with_meson => 0, custom_build => 1, extract_dir => 'icu'},
{name => 'tepl-6', url => 'https://download.gnome.org/sources/tepl ... 0.2.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false']},
{name => 'enchant', url => 'https://github.com/AbiWord/enchant/rele ... 3.3.tar.gz',
build_with_meson => 0, configure_options => ['--disable-static']},
{name => 'gspell', url => 'https://download.gnome.org/sources/gspe ... 9.1.tar.xz',
build_with_meson => 0, configure_options => ['--disable-gtk-doc', '--disable-vala']},
{name => 'gedit-3.38', url => 'https://download.gnome.org/sources/gedi ... 8.1.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false', '-Duser_documentation=false'], rename_binary => 'gedit3',
patches => [
{file => 'data/meson.build', search => qr/appdata_file = i18n\.merge_file\(\s*\n\s*appdata,\s*\n/s,
replace => "appdata_file = i18n.merge_file(\n"},
{file => 'data/meson.build', search => qr/desktop_output_file = i18n\.merge_file\(\s*\n\s*desktop_file,\s*\n/s,
replace => "desktop_output_file = i18n.merge_file(\n"},
{file => 'gedit/meson.build',
search => qr/libgedit_vapi = gnome\.generate_vapi\(\n 'gedit',\n sources: libgedit_gir\[0\],\n packages: \['gio-2\.0', 'atk', 'gdk-3\.0', 'gtk\+-3\.0', 'gtksourceview-4'\],\n install: true,\n install_dir: get_option\('datadir'\) \/ 'vala\/vapi',\n\)/,
replace => '# Vapi generation commented out (requires vapigen)'},
]},
);
sub get_marker_file { my $n = shift; $n =~ s/[^a-zA-Z0-9_-]/_/g; "$marker_dir/$n.built" }
sub is_built { return 0 if $force_rebuild; -f get_marker_file(shift) }
sub mark_as_built {
my $n = shift;
open my $f, '>', get_marker_file($n);
print $f "Built: " . localtime() . "\n";
close $f;
}
sub setup_build_tools {
print "Setting up build tools...\n";
unless (-x $meson_bin) { system("python3 -m pip install --user meson") == 0 or die "Meson install failed\n"; }
unless (-x $ninja_bin) { system("python3 -m pip install --user ninja") == 0 or die "Ninja install failed\n"; }
}
sub setup_environment {
$ENV{PKG_CONFIG_PATH} = "$install_dir/lib/pkgconfig:$install_dir/lib/x86_64-linux-gnu/pkgconfig:$install_dir/share/pkgconfig";
$ENV{LD_LIBRARY_PATH} = "$install_dir/lib:$install_dir/lib/x86_64-linux-gnu";
$ENV{PATH} = "$install_dir/bin:$ENV{HOME}/.local/bin:$ENV{PATH}";
$ENV{GI_TYPELIB_PATH} = "$install_dir/lib/girepository-1.0:$install_dir/lib/x86_64-linux-gnu/girepository-1.0";
$ENV{XDG_DATA_DIRS} = "$install_dir/share:$ENV{XDG_DATA_DIRS}";
$ENV{GI_GIR_PATH} = "$install_dir/share/gir-1.0";
$ENV{ACLOCAL_PATH} = "$install_dir/share/aclocal";
$ENV{CPPFLAGS} = "-I$install_dir/include";
my $py_ld = `python3-config --ldflags --embed 2>/dev/null` || `python3-config --ldflags 2>/dev/null` || "";
chomp $py_ld;
$ENV{LDFLAGS} = "-L$install_dir/lib $py_ld";
$ENV{GDK_PIXBUF_MODULEDIR} = "$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders";
$ENV{GDK_PIXBUF_MODULE_FILE} = "$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache";
}
sub extract_archive {
my $f = shift;
die "Archive not found: $f\n" unless -f $f;
my %ext = ('.tar.xz' => 'tar -xf', '.tar.gz' => 'tar -xzf', '.tgz' => 'tar -xzf', '.tar.bz2' => 'tar -xjf');
my ($cmd) = grep { $f =~ /\Q$_\E$/ } keys %ext;
die "Unknown format: $f\n" unless $cmd;
system("$ext{$cmd} '$f'") == 0 or die "Extract failed: $f\n";
}
sub apply_patches {
my ($dep, $dir) = @_;
return unless $dep->{patches};
foreach my $p (@{$dep->{patches}}) {
next unless -f $p->{file};
open my $fh, '{file}' '$p->{file}.backup'") unless -f "$p->{file}.backup";
$c =~ s/$p->{search}/$p->{replace}/g;
open my $out, '>', $p->{file}; print $out $c; close $out;
}
}
sub download_file {
my ($url, $file) = @_;
return 1 if -f $file && -s $file > 10240;
system("curl -L -J -o '$file' '$url'") == 0 or die "Download failed: $file\n";
rename("download", $file) if -f "download";
die "Download too small\n" if -s $file < 10240;
}
sub build_dispatch {
my ($dep, $dir) = @_;
my $nproc = `nproc 2>/dev/null` || 4; chomp $nproc;
if ($dep->{custom_build} && $dep->{name} eq 'icu') {
chdir "source";
system("./runConfigureICU Linux --prefix=$install_dir --enable-shared --disable-static") == 0 or die;
system("make -j$nproc && make install") == 0 or die;
chdir "..";
return;
}
if ($dep->{build_with_meson}) {
system("rm -rf builddir") if -d "builddir";
my @opts = $dep->{meson_options} ? @{$dep->{meson_options}} : ();
system("$meson_bin setup builddir --prefix=$install_dir --libdir=lib @opts") == 0 or die;
if ($dep->{name} eq 'libpeas') {
system("$ninja_bin -C builddir 2>&1 | grep -v 'tests/' || true");
system("cd builddir && $ninja_bin install 2>&1 | grep -v 'tests/' || true");
system("mkdir -p $install_dir/lib/pkgconfig");
for my $pc qw(libpeas-1.0.pc libpeas-gtk-1.0.pc) {
next if -f "$install_dir/lib/pkgconfig/$pc";
open my $f, '>', "$install_dir/lib/pkgconfig/$pc";
print $f "prefix=$install_dir\nlibdir=\${prefix}/lib\nName: $pc\nVersion: 1.32.0\n";
close $f;
}
} else {
system("$ninja_bin -C builddir && $ninja_bin -C builddir install") == 0 or die;
}
return;
}
if ($dep->{build_with_cmake}) {
mkdir "build"; chdir "build";
my @opts = $dep->{configure_options} ? @{$dep->{configure_options}} : ();
system("cmake .. -DCMAKE_INSTALL_PREFIX=$install_dir @opts && make -j$nproc && make install") == 0 or die;
chdir "..";
return;
}
my @opts = $dep->{configure_options} ? @{$dep->{configure_options}} : ();
system("./configure --prefix=$install_dir @opts && make -j$nproc && make install") == 0 or die;
}
sub post_install {
my $dep = shift;
if ($dep->{name} eq 'libepoxy') {
my $pc = "$install_dir/lib/pkgconfig/epoxy.pc";
if (-f $pc) {
open my $f, '', $pc; print $o @l; close $o;
}
}
if ($dep->{name} eq 'gdk-pixbuf') {
my $ld = "$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders";
my $cf = "$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache";
system("mkdir -p '$ld'");
my $ql = "$install_dir/bin/gdk-pixbuf-query-loaders";
system("'$ql' '$ld'/*.so > '$cf' 2>&1") if -x $ql;
}
if ($dep->{rename_binary}) {
rename("$install_dir/bin/gedit", "$install_dir/bin/$dep->{rename_binary}");
}
}
sub build_dependency {
my $dep = shift;
return if is_built($dep->{name});
my $url = $dep->{url};
$url =~ s/\/download$//;
my $file = basename($url);
my $dir = $file; $dir =~ s/\.(tar\.(xz|gz|bz2)|tgz)$//;
printf "[%s]\n", $dep->{name};
chdir $build_dir;
download_file($dep->{url}, $file);
extract_archive($file);
$dir = 'icu' if $dep->{name} eq 'icu' && !-d $dir && -d 'icu';
chdir $dir or die "Dir not found: $dir\n";
apply_patches($dep, $dir);
build_dispatch($dep, $dir);
post_install($dep);
mark_as_built($dep->{name});
chdir $build_dir;
}
sub create_setup_script {
open my $f, '>', "$install_dir/setup_gtk3_env.sh" or die;
print $f "#!/bin/bash\n";
print $f "export PKG_CONFIG_PATH=\"$install_dir/lib/pkgconfig:$install_dir/lib/x86_64-linux-gnu/pkgconfig:\$PKG_CONFIG_PATH\"\n";
print $f "export LD_LIBRARY_PATH=\"$install_dir/lib:$install_dir/lib/x86_64-linux-gnu:\$LD_LIBRARY_PATH\"\n";
print $f "export PATH=\"$install_dir/bin:\$PATH\"\n";
print $f "export GI_TYPELIB_PATH=\"$install_dir/lib/girepository-1.0\"\n";
print $f "export XDG_DATA_DIRS=\"$install_dir/share:\$XDG_DATA_DIRS\"\n";
print $f "export GDK_PIXBUF_MODULEDIR=\"$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders\"\n";
print $f "export GDK_PIXBUF_MODULE_FILE=\"$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache\"\n";
print $f "PYTHON_SITE=\$(find $install_dir/lib -type d -name 'site-packages' 2>/dev/null | head -1)\n";
print $f "[ -n \"\$PYTHON_SITE\" ] && export PYTHONPATH=\"\$PYTHON_SITE:\$PYTHONPATH\"\n";
print $f "echo \"GTK3 ready. Run: gedit3\"\n";
close $f;
chmod 0755, "$install_dir/setup_gtk3_env.sh";
}
sub main {
print "GTK3 + PyGObject + gedit Installer\n";
print "Install: $install_dir | Build: $build_dir\n";
printf "Status: %d/%d built\n", scalar(grep { is_built($_->{name}) } @dependencies), scalar(@dependencies);
print "Continue? (y/N): "; chomp(my $r = ); exit unless $r =~ /^[yY]/;
setup_build_tools();
setup_environment();
my $n = 0;
foreach my $dep (@dependencies) {
printf "\n[%d/%d] %s\n", ++$n, scalar(@dependencies), $dep->{name};
build_dependency($dep);
}
create_setup_script();
print "\n✓ Complete! Source: $install_dir/setup_gtk3_env.sh\n";
print "Test: source $install_dir/setup_gtk3_env.sh && gedit3\n";
return 0;
}
exit main();
Подробнее здесь: https://stackoverflow.com/questions/797 ... s-and-with
Как установить gtk3 и gedit3 в системе Linux без библиотек gtk3 и без пароля root ⇐ Linux
1760037837
Anonymous
Как установить gtk3 и gedit3 в системе Linux без библиотек gtk3 и без пароля root...
Просто отдаю это, потому что это пустая трата времени, но может быть полезно для кого-то... кто знает:
ОТКАЗ ОТ ОТВЕТСТВЕННОСТИ: если это снова сломается, потому что у него слишком много зависимостей, просто запустите его через AI несколько раз, чтобы исправить это:
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
use File::Path qw(make_path);
use Getopt::Long;
my ($force_rebuild, $clean_markers) = (0, 0);
GetOptions('force' => \$force_rebuild, 'clean-markers' => \$clean_markers)
or die "Usage: $0 [--force] [--clean-markers]\n";
my $install_dir = "$ENV{HOME}/local";
my $build_dir = "$ENV{HOME}/gtk3_build_temp";
my $marker_dir = "$build_dir/.build_markers";
my ($meson_bin, $ninja_bin) = ("$ENV{HOME}/.local/bin/meson", "$ENV{HOME}/.local/bin/ninja");
make_path($install_dir, $build_dir, $marker_dir) unless -d $marker_dir;
if ($clean_markers) {
system("rm -f $marker_dir/*");
print "Markers cleaned. Packages will rebuild on next run.\n";
exit 0;
}
# Generate X11 libs programmatically
sub x11_libs {
my @x11 = (
['util-macros', 'https://www.x.org/archive/individual/util/util-macros-1.19.3.tar.bz2'],
['xorgproto', 'https://xorg.freedesktop.org/archive/individual/proto/xorgproto-2021.5.tar.bz2'],
['libXau', 'https://www.x.org/archive/individual/lib/libXau-1.0.11.tar.gz'],
['libXdmcp', 'https://www.x.org/archive/individual/lib/libXdmcp-1.1.4.tar.gz'],
['xcb-proto', 'https://xorg.freedesktop.org/archive/individual/proto/xcb-proto-1.15.2.tar.xz'],
['libpthread-stubs', 'https://xcb.freedesktop.org/dist/libpthread-stubs-0.4.tar.gz'],
['libxcb', 'https://www.x.org/archive/individual/lib/libxcb-1.15.tar.xz'],
['xtrans', 'https://www.x.org/archive/individual/lib/xtrans-1.4.0.tar.gz'],
['libX11', 'https://www.x.org/archive/individual/lib/libX11-1.8.4.tar.gz'],
['libXext', 'https://www.x.org/archive/individual/lib/libXext-1.3.5.tar.gz'],
['libXrender', 'https://www.x.org/archive/individual/lib/libXrender-0.9.11.tar.gz'],
['libXfixes', 'https://www.x.org/archive/individual/lib/libXfixes-6.0.0.tar.gz'],
['libXrandr', 'https://www.x.org/archive/individual/lib/libXrandr-1.5.3.tar.gz'],
['libXi', 'https://www.x.org/archive/individual/lib/libXi-1.8.tar.gz'],
['libXcursor', 'https://www.x.org/archive/individual/lib/libXcursor-1.2.1.tar.gz'],
['libXdamage', 'https://www.x.org/archive/individual/lib/libXdamage-1.1.6.tar.gz'],
['libXcomposite', 'https://www.x.org/archive/individual/lib/libXcomposite-0.4.6.tar.gz'],
['libXinerama', 'https://www.x.org/archive/individual/lib/libXinerama-1.1.5.tar.gz'],
['libXtst', 'https://www.x.org/archive/individual/lib/libXtst-1.2.4.tar.gz'],
);
return map { {name => $_->[0], url => $_->[1], build_with_meson => 0} } @x11;
}
my @dependencies = (
{name => 'pkg-config', url => 'https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz',
build_with_meson => 0, configure_options => ['--with-internal-glib']},
{name => 'bison', url => 'https://mirrors.kernel.org/gnu/bison/bison-3.8.2.tar.xz', build_with_meson => 0},
{name => 'cmake', url => 'https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1.tar.gz',
build_with_meson => 0, configure_options => ['--parallel=' . (`nproc 2>/dev/null` || 4)]},
{name => 'zlib', url => 'https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz', build_with_meson => 0},
{name => 'libffi', url => 'https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4.tar.gz', build_with_meson => 0},
{name => 'pcre', url => 'https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz/download',
build_with_meson => 0, configure_options => ['--enable-unicode-properties', '--enable-pcre16', '--enable-pcre32']},
{name => 'glib', url => 'https://download.gnome.org/sources/glib/2.70/glib-2.70.0.tar.xz',
build_with_meson => 1, meson_options => ['-Dlibmount=disabled', '--wrap-mode=nofallback']},
{name => 'gobject-introspection', url => 'https://download.gnome.org/sources/gobject-introspection/1.72/gobject-introspection-1.72.0.tar.xz',
build_with_meson => 1, meson_options => ['-Ddoctool=disabled', '-Dcairo=disabled', '--wrap-mode=nofallback']},
{name => 'libpng', url => 'https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.xz/download',
build_with_meson => 0, configure_options => ['--enable-shared', '--enable-static']},
{name => 'libjpeg-turbo', url => 'https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/2.1.4/libjpeg-turbo-2.1.4.tar.gz',
build_with_meson => 0, build_with_cmake => 1, configure_options => ['-DWITH_JPEG8=ON']},
{name => 'libxml2', url => 'https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.tar.xz',
build_with_meson => 0, configure_options => ['--without-python', '--without-lzma']},
{name => 'shared-mime-info', url => 'https://gitlab.freedesktop.org/xdg/shared-mime-info/-/archive/2.2/shared-mime-info-2.2.tar.gz',
build_with_meson => 1, meson_options => ['-Dupdate-mimedb=false']},
{name => 'gdk-pixbuf', url => 'https://download.gnome.org/sources/gdk-pixbuf/2.42/gdk-pixbuf-2.42.6.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false', '-Dman=false', '-Dinstalled_tests=false', '-Dbuiltin_loaders=none']},
x11_libs(), # Insert all X11 libraries
{name => 'pixman', url => 'https://cairographics.org/releases/pixman-0.40.0.tar.gz', build_with_meson => 0},
{name => 'freetype', url => 'https://download.savannah.gnu.org/releases/freetype/freetype-2.11.0.tar.xz',
build_with_meson => 0, configure_options => ['--enable-freetype-config']},
{name => 'fontconfig', url => 'https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.94.tar.xz', build_with_meson => 0},
{name => 'cairo', url => 'https://cairographics.org/releases/cairo-1.16.0.tar.xz', build_with_meson => 0},
{name => 'harfbuzz', url => 'https://github.com/harfbuzz/harfbuzz/releases/download/3.0.0/harfbuzz-3.0.0.tar.xz', build_with_meson => 1},
{name => 'fribidi', url => 'https://github.com/fribidi/fribidi/releases/download/v1.0.11/fribidi-1.0.11.tar.xz', build_with_meson => 1},
{name => 'pango', url => 'https://download.gnome.org/sources/pango/1.48/pango-1.48.10.tar.xz', build_with_meson => 1},
{name => 'atk', url => 'https://download.gnome.org/sources/atk/2.36/atk-2.36.0.tar.xz', build_with_meson => 1},
{name => 'expat', url => 'https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.xz',
build_with_meson => 0, configure_options => ['--without-docbook']},
{name => 'dbus', url => 'https://dbus.freedesktop.org/releases/dbus/dbus-1.14.4.tar.xz',
build_with_meson => 0, configure_options => ['--disable-systemd', '--disable-tests']},
{name => 'at-spi2-core', url => 'https://download.gnome.org/sources/at-spi2-core/2.42/at-spi2-core-2.42.0.tar.xz',
build_with_meson => 1, meson_options => ['-Ddocs=false', '-Dx11=yes']},
{name => 'at-spi2-atk', url => 'https://download.gnome.org/sources/at-spi2-atk/2.38/at-spi2-atk-2.38.0.tar.xz', build_with_meson => 1},
{name => 'libepoxy', url => 'https://download.gnome.org/sources/libepoxy/1.5/libepoxy-1.5.10.tar.xz', build_with_meson => 1},
{name => 'gtk+', url => 'https://download.gnome.org/sources/gtk+/3.24/gtk+-3.24.43.tar.xz',
build_with_meson => 1, meson_options => ['-Dx11_backend=true', '-Dwayland_backend=false', '-Dintrospection=true']},
{name => 'gtksourceview', url => 'https://download.gnome.org/sources/gtksourceview/4.8/gtksourceview-4.8.2.tar.xz',
build_with_meson => 1, meson_options => ['-Dgir=true', '-Dvapi=false']},
{name => 'pygobject', url => 'https://download.gnome.org/sources/pygobject/3.42/pygobject-3.42.0.tar.xz', build_with_meson => 1},
{name => 'gsettings-desktop-schemas', url => 'https://download.gnome.org/sources/gsettings-desktop-schemas/41/gsettings-desktop-schemas-41.0.tar.xz',
build_with_meson => 1},
{name => 'libpeas', url => 'https://download.gnome.org/sources/libpeas/1.32/libpeas-1.32.0.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false', '-Dvapi=false', '-Ddemos=false', '-Dintrospection=true', '--wrap-mode=nofallback']},
{name => 'amtk', url => 'https://download.gnome.org/sources/amtk/5.3/amtk-5.3.1.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false']},
{name => 'icu', url => 'https://github.com/unicode-org/icu/releases/download/release-70-1/icu4c-70_1-src.tgz',
build_with_meson => 0, custom_build => 1, extract_dir => 'icu'},
{name => 'tepl-6', url => 'https://download.gnome.org/sources/tepl/6.0/tepl-6.0.2.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false']},
{name => 'enchant', url => 'https://github.com/AbiWord/enchant/releases/download/v2.3.3/enchant-2.3.3.tar.gz',
build_with_meson => 0, configure_options => ['--disable-static']},
{name => 'gspell', url => 'https://download.gnome.org/sources/gspell/1.9/gspell-1.9.1.tar.xz',
build_with_meson => 0, configure_options => ['--disable-gtk-doc', '--disable-vala']},
{name => 'gedit-3.38', url => 'https://download.gnome.org/sources/gedit/3.38/gedit-3.38.1.tar.xz',
build_with_meson => 1, meson_options => ['-Dgtk_doc=false', '-Duser_documentation=false'], rename_binary => 'gedit3',
patches => [
{file => 'data/meson.build', search => qr/appdata_file = i18n\.merge_file\(\s*\n\s*appdata,\s*\n/s,
replace => "appdata_file = i18n.merge_file(\n"},
{file => 'data/meson.build', search => qr/desktop_output_file = i18n\.merge_file\(\s*\n\s*desktop_file,\s*\n/s,
replace => "desktop_output_file = i18n.merge_file(\n"},
{file => 'gedit/meson.build',
search => qr/libgedit_vapi = gnome\.generate_vapi\(\n 'gedit',\n sources: libgedit_gir\[0\],\n packages: \['gio-2\.0', 'atk', 'gdk-3\.0', 'gtk\+-3\.0', 'gtksourceview-4'\],\n install: true,\n install_dir: get_option\('datadir'\) \/ 'vala\/vapi',\n\)/,
replace => '# Vapi generation commented out (requires vapigen)'},
]},
);
sub get_marker_file { my $n = shift; $n =~ s/[^a-zA-Z0-9_-]/_/g; "$marker_dir/$n.built" }
sub is_built { return 0 if $force_rebuild; -f get_marker_file(shift) }
sub mark_as_built {
my $n = shift;
open my $f, '>', get_marker_file($n);
print $f "Built: " . localtime() . "\n";
close $f;
}
sub setup_build_tools {
print "Setting up build tools...\n";
unless (-x $meson_bin) { system("python3 -m pip install --user meson") == 0 or die "Meson install failed\n"; }
unless (-x $ninja_bin) { system("python3 -m pip install --user ninja") == 0 or die "Ninja install failed\n"; }
}
sub setup_environment {
$ENV{PKG_CONFIG_PATH} = "$install_dir/lib/pkgconfig:$install_dir/lib/x86_64-linux-gnu/pkgconfig:$install_dir/share/pkgconfig";
$ENV{LD_LIBRARY_PATH} = "$install_dir/lib:$install_dir/lib/x86_64-linux-gnu";
$ENV{PATH} = "$install_dir/bin:$ENV{HOME}/.local/bin:$ENV{PATH}";
$ENV{GI_TYPELIB_PATH} = "$install_dir/lib/girepository-1.0:$install_dir/lib/x86_64-linux-gnu/girepository-1.0";
$ENV{XDG_DATA_DIRS} = "$install_dir/share:$ENV{XDG_DATA_DIRS}";
$ENV{GI_GIR_PATH} = "$install_dir/share/gir-1.0";
$ENV{ACLOCAL_PATH} = "$install_dir/share/aclocal";
$ENV{CPPFLAGS} = "-I$install_dir/include";
my $py_ld = `python3-config --ldflags --embed 2>/dev/null` || `python3-config --ldflags 2>/dev/null` || "";
chomp $py_ld;
$ENV{LDFLAGS} = "-L$install_dir/lib $py_ld";
$ENV{GDK_PIXBUF_MODULEDIR} = "$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders";
$ENV{GDK_PIXBUF_MODULE_FILE} = "$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache";
}
sub extract_archive {
my $f = shift;
die "Archive not found: $f\n" unless -f $f;
my %ext = ('.tar.xz' => 'tar -xf', '.tar.gz' => 'tar -xzf', '.tgz' => 'tar -xzf', '.tar.bz2' => 'tar -xjf');
my ($cmd) = grep { $f =~ /\Q$_\E$/ } keys %ext;
die "Unknown format: $f\n" unless $cmd;
system("$ext{$cmd} '$f'") == 0 or die "Extract failed: $f\n";
}
sub apply_patches {
my ($dep, $dir) = @_;
return unless $dep->{patches};
foreach my $p (@{$dep->{patches}}) {
next unless -f $p->{file};
open my $fh, '{file}' '$p->{file}.backup'") unless -f "$p->{file}.backup";
$c =~ s/$p->{search}/$p->{replace}/g;
open my $out, '>', $p->{file}; print $out $c; close $out;
}
}
sub download_file {
my ($url, $file) = @_;
return 1 if -f $file && -s $file > 10240;
system("curl -L -J -o '$file' '$url'") == 0 or die "Download failed: $file\n";
rename("download", $file) if -f "download";
die "Download too small\n" if -s $file < 10240;
}
sub build_dispatch {
my ($dep, $dir) = @_;
my $nproc = `nproc 2>/dev/null` || 4; chomp $nproc;
if ($dep->{custom_build} && $dep->{name} eq 'icu') {
chdir "source";
system("./runConfigureICU Linux --prefix=$install_dir --enable-shared --disable-static") == 0 or die;
system("make -j$nproc && make install") == 0 or die;
chdir "..";
return;
}
if ($dep->{build_with_meson}) {
system("rm -rf builddir") if -d "builddir";
my @opts = $dep->{meson_options} ? @{$dep->{meson_options}} : ();
system("$meson_bin setup builddir --prefix=$install_dir --libdir=lib @opts") == 0 or die;
if ($dep->{name} eq 'libpeas') {
system("$ninja_bin -C builddir 2>&1 | grep -v 'tests/' || true");
system("cd builddir && $ninja_bin install 2>&1 | grep -v 'tests/' || true");
system("mkdir -p $install_dir/lib/pkgconfig");
for my $pc qw(libpeas-1.0.pc libpeas-gtk-1.0.pc) {
next if -f "$install_dir/lib/pkgconfig/$pc";
open my $f, '>', "$install_dir/lib/pkgconfig/$pc";
print $f "prefix=$install_dir\nlibdir=\${prefix}/lib\nName: $pc\nVersion: 1.32.0\n";
close $f;
}
} else {
system("$ninja_bin -C builddir && $ninja_bin -C builddir install") == 0 or die;
}
return;
}
if ($dep->{build_with_cmake}) {
mkdir "build"; chdir "build";
my @opts = $dep->{configure_options} ? @{$dep->{configure_options}} : ();
system("cmake .. -DCMAKE_INSTALL_PREFIX=$install_dir @opts && make -j$nproc && make install") == 0 or die;
chdir "..";
return;
}
my @opts = $dep->{configure_options} ? @{$dep->{configure_options}} : ();
system("./configure --prefix=$install_dir @opts && make -j$nproc && make install") == 0 or die;
}
sub post_install {
my $dep = shift;
if ($dep->{name} eq 'libepoxy') {
my $pc = "$install_dir/lib/pkgconfig/epoxy.pc";
if (-f $pc) {
open my $f, '', $pc; print $o @l; close $o;
}
}
if ($dep->{name} eq 'gdk-pixbuf') {
my $ld = "$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders";
my $cf = "$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache";
system("mkdir -p '$ld'");
my $ql = "$install_dir/bin/gdk-pixbuf-query-loaders";
system("'$ql' '$ld'/*.so > '$cf' 2>&1") if -x $ql;
}
if ($dep->{rename_binary}) {
rename("$install_dir/bin/gedit", "$install_dir/bin/$dep->{rename_binary}");
}
}
sub build_dependency {
my $dep = shift;
return if is_built($dep->{name});
my $url = $dep->{url};
$url =~ s/\/download$//;
my $file = basename($url);
my $dir = $file; $dir =~ s/\.(tar\.(xz|gz|bz2)|tgz)$//;
printf "[%s]\n", $dep->{name};
chdir $build_dir;
download_file($dep->{url}, $file);
extract_archive($file);
$dir = 'icu' if $dep->{name} eq 'icu' && !-d $dir && -d 'icu';
chdir $dir or die "Dir not found: $dir\n";
apply_patches($dep, $dir);
build_dispatch($dep, $dir);
post_install($dep);
mark_as_built($dep->{name});
chdir $build_dir;
}
sub create_setup_script {
open my $f, '>', "$install_dir/setup_gtk3_env.sh" or die;
print $f "#!/bin/bash\n";
print $f "export PKG_CONFIG_PATH=\"$install_dir/lib/pkgconfig:$install_dir/lib/x86_64-linux-gnu/pkgconfig:\$PKG_CONFIG_PATH\"\n";
print $f "export LD_LIBRARY_PATH=\"$install_dir/lib:$install_dir/lib/x86_64-linux-gnu:\$LD_LIBRARY_PATH\"\n";
print $f "export PATH=\"$install_dir/bin:\$PATH\"\n";
print $f "export GI_TYPELIB_PATH=\"$install_dir/lib/girepository-1.0\"\n";
print $f "export XDG_DATA_DIRS=\"$install_dir/share:\$XDG_DATA_DIRS\"\n";
print $f "export GDK_PIXBUF_MODULEDIR=\"$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders\"\n";
print $f "export GDK_PIXBUF_MODULE_FILE=\"$install_dir/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache\"\n";
print $f "PYTHON_SITE=\$(find $install_dir/lib -type d -name 'site-packages' 2>/dev/null | head -1)\n";
print $f "[ -n \"\$PYTHON_SITE\" ] && export PYTHONPATH=\"\$PYTHON_SITE:\$PYTHONPATH\"\n";
print $f "echo \"GTK3 ready. Run: gedit3\"\n";
close $f;
chmod 0755, "$install_dir/setup_gtk3_env.sh";
}
sub main {
print "GTK3 + PyGObject + gedit Installer\n";
print "Install: $install_dir | Build: $build_dir\n";
printf "Status: %d/%d built\n", scalar(grep { is_built($_->{name}) } @dependencies), scalar(@dependencies);
print "Continue? (y/N): "; chomp(my $r = ); exit unless $r =~ /^[yY]/;
setup_build_tools();
setup_environment();
my $n = 0;
foreach my $dep (@dependencies) {
printf "\n[%d/%d] %s\n", ++$n, scalar(@dependencies), $dep->{name};
build_dependency($dep);
}
create_setup_script();
print "\n✓ Complete! Source: $install_dir/setup_gtk3_env.sh\n";
print "Test: source $install_dir/setup_gtk3_env.sh && gedit3\n";
return 0;
}
exit main();
Подробнее здесь: [url]https://stackoverflow.com/questions/79786781/how-to-install-gtk3-and-gedit3-on-a-linux-system-with-no-gtk3-libraries-and-with[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия