diff --git a/src/main.cr b/src/main.cr index 84bfc63..61b9f9a 100644 --- a/src/main.cr +++ b/src/main.cr @@ -32,6 +32,80 @@ recipes << Recipe.new(context, "hello", "2.10").tap do |recipe| #end end +recipes << Recipe.new(context, "automake", "1.16").tap do |recipe| + recipe.sources << "https://ftp.gnu.org/gnu/automake/automake-#{recipe.version}.tar.gz" +end + +recipes << Recipe.new(context, "autoconf", "2.69").tap do |recipe| + recipe.sources << "https://ftp.gnu.org/gnu/autoconf/autoconf-#{recipe.version}.tar.gz" + + recipe.dependencies << "m4" << "perl" +end + +recipes << Recipe.new(context, "libtool", "2.4.6").tap do |recipe| + recipe.sources << "http://ftpmirror.gnu.org/libtool/libtool-#{recipe.version}.tar.gz" +end + +recipes << Recipe.new(context, "m4", "1.4.18").tap do |recipe| + recipe.sources << "https://ftp.gnu.org/gnu/m4/m4-#{recipe.version}.tar.gz" + recipe.dependencies << "perl" +end + +recipes << Recipe.new(context, "bzip2", "1.0.6").tap do |recipe| + recipe.sources << "https://downloads.sourceforge.net/project/bzip2/bzip2-#{recipe.version}.tar.gz" + + recipe.instructions.configure << "sed -i.orig -e '/^CFLAGS=/s/.*/CFLAGS = -O2 -fPIC/' #{recipe.dirname}/Makefile" + recipe.options["make install"] = "PREFIX='#{recipe.fake_root_directory}/usr'" +end + +recipes << Recipe.new(context, "perl", "5.30.0").tap do |recipe| + recipe.sources << "https://www.cpan.org/src/5.0/perl-#{recipe.version}.tar.gz" + + recipe.dependencies << "zlib" << "bzip2" + + recipe.instructions.build << %( + set -e -x; + cd #{recipe.dirname}; + BUILD_ZLIB=0; + BUILD_BZIP2=0; + BZIP2_LIB=/usr/lib; + BZIP2_INCLUDE=/usr/inculde; + + export BUILD_ZLIB BUILD_BZIP2 BZIP2_LIB BZIP2_INCLUDE; + ./Configure -des \ + -Dcccdlflags='-fPIC' \ + -Dcccdlflags='-fPIC' \ + -Dccdlflags='-rdynamic' \ + -Dprefix=/usr \ + -Uprivlib=$_privlib \ + -Darchlib=$_archlib \ + -Dvendorprefix=/usr \ + -Dvendorlib=/usr/share/perl5/vendor_perl \ + -Dvendorarch=/usr/lib/perl5/vendor_perl \ + -Dsiteprefix=/usr/local \ + -Dsitelib=/usr/local/share/perl5/site_perl \ + -Dsitearch=/usr/local/lib/perl5/site_perl \ + -Dlocincpth=' ' \ + -Dcc=gcc \ + -Uoptimize="$CFLAGS" \ + -Duselargefiles \ + -Dusethreads \ + -Duseshrplib \ + -Dd_semctl_semun \ + -Dman1dir=/usr/share/man/man1 \ + -Dman3dir=/usr/share/man/man3 \ + -Dinstallman1dir=/usr/share/man/man1 \ + -Dinstallman3dir=/usr/share/man/man3 \ + -Dman1ext='1' \ + -Dman3ext='3pm' \ + -Dcf_by='Alpine' \ + -Ud_csh \ + -Dusenm \ + || return 1 + make libperl.so && make || return 1 + ) +end + recipes << Recipe.new(context, "apk-tools", "2.10.4").tap do |recipe| recipe.sources << "https://dev.alpinelinux.org/archive/apk-tools/apk-tools-#{recipe.version}.tar.xz" @@ -49,13 +123,43 @@ recipes << Recipe.new(context, "apk-tools", "2.10.4").tap do |recipe| recipe.instructions.install << "mkdir -p '#{recipe.fake_root_directory}#{dir}'" end - #recipe.build_dependencies << "zlib-dev" << "openssl-dev" + #recipe.build_dependencies << "zlib-dev" << "openssl-dev" << "linux-dev" end recipes << Recipe.new(context, "abuild", "3.4.0").tap do |recipe| recipe.sources << "https://dev.alpinelinux.org/archive/abuild/abuild-#{recipe.version}.tar.xz" end +recipes << Recipe.new(context, "pkg-config", "0.29.2").tap do |recipe| + recipe.sources << "http://pkgconfig.freedesktop.org/releases/pkg-config-#{recipe.version}.tar.gz" + + # FIXME: We’ll want to remove this at some point. + recipe.options["configure"] = "--with-internal-glib" +end + +recipes << Recipe.new(context, "tar", "1.32").tap do |recipe| + recipe.sources << "http://ftp.gnu.org/gnu/tar/tar-#{recipe.version}.tar.gz" + recipe.options["configure"] = "FORCE_UNSAFE_CONFIGURE=1" +end + +recipes << Recipe.new(context, "libarchive", "3.3.3").tap do |recipe| + recipe.sources << "https://www.libarchive.org/downloads/libarchive-#{recipe.version}.tar.gz" + + # Conflicts with “tar” (gnu tar) + #recipe.instructions.install << "cd #{recipe.dirname} && make DESTDIR='#{recipe.fake_root_directory}' install" + #recipe.instructions.install << "cd '#{recipe.fake_root_directory}' && ln -s /usr/bin/bsdtar usr/bin/tar" +end + +# FIXME: Build and install the actual kernel. +recipes << Recipe.new(context, "linux", "5.2.4").tap do |recipe| + recipe.sources << "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-#{recipe.version}.tar.xz" + + recipe.instructions.build << "true" + + recipe.instructions.install << "mkdir -p '#{recipe.fake_root_directory}/usr'" + recipe.instructions.install << "cd '#{recipe.dirname}' && make headers_install ARCH=x86_64 INSTALL_HDR_PATH='#{recipe.fake_root_directory}/usr'" +end + recipes << Recipe.new(context, "make", "4.2").tap do |recipe| recipe.sources << "https://ftp.gnu.org/gnu/make/make-#{recipe.version}.tar.gz" end @@ -70,6 +174,7 @@ recipes << Recipe.new(context, "sysvinit", "2.95").tap do |recipe| recipe.sources << "https://git.savannah.nongnu.org/cgit/sysvinit.git/snapshot/sysvinit-#{recipe.version}.tar.gz" recipe.url = "https://savannah.nongnu.org/projects/sysvinit" recipe.description = "System V-like init system." + recipe.dependencies << "util-linux" recipe.instructions.install << "cd sysvinit-#{recipe.version} && make ROOT='#{recipe.fake_root_directory}' install" end @@ -85,6 +190,46 @@ end recipes << Recipe.new(context, "libffi", "3.2.1").tap do |recipe| recipe.sources << "ftp://sourceware.org/pub/libffi/libffi-#{recipe.version}.tar.gz" + + recipe.instructions.install << %{ + set -e; + cd #{recipe.dirname}; + make DESTDIR="#{recipe.fake_root_directory}" install; + cd "#{recipe.fake_root_directory}"; + mv usr/lib/libffi-#{recipe.version}/include usr; + nuke usr/lib/libffi-#{recipe.version} + } +end + +recipes << Recipe.new(context, "python", "3.7.4").tap do |recipe| + recipe.sources << "https://www.python.org/ftp/python/#{recipe.version}/Python-#{recipe.version}.tgz" + recipe.dirname = "Python-#{recipe.version}" +end + +recipes << Recipe.new(context, "crystal", "0.29.9").tap do |recipe| + # FIXME: Arrows, ASAP. + #recipe.sources << "https://github.com/crystal-lang/crystal/archive/#{recipe.version}.tar.gz" + + recipe.dirname = "crystal-8b3dba72bd681118b2b761c68d7d2fdcbbbfceb2" + recipe.sources << "https://github.com/crystal-lang/crystal/archive/8b3dba72bd681118b2b761c68d7d2fdcbbbfceb2.zip" + + recipe.dependencies << "libyaml" << "libevent" << "pcre" << "openssl" + + recipe.options["make"] = "release=1 LLVM_CONFIG=/usr/bad/llvm-6/bin/llvm-config" + recipe.instructions.install << %{ + set -e + cd #{recipe.dirname}; + PKG="#{recipe.fake_root_directory}"; + mkdir -p "$PKG/usr/bin"; + mkdir -p "$PKG/usr/lib/crystal/core"; + mkdir -p "$PKG/usr/share/man/man1"; + + install -D -m 755 .build/crystal "$PKG"/usr/bin/crystal; + install -D -m 644 man/crystal.1 "$PKG"/usr/share/man/man1/crystal.1; + cp -r src/* "$PKG/usr/lib/crystal/core"; + cd "$PKG/usr/lib/crystal/core"; + nuke ext/sigfault.* llvm/ext/llvm_ext.o + } end [{"6", "6.0.1"}, {"7", "7.1.0"},{"8", "8.0.0"}].each do |branch, version| @@ -132,6 +277,10 @@ EOF end end +recipes << Recipe.new(context, "cmake", "3.15.1").tap do |recipe| + recipe.sources << "https://github.com/Kitware/CMake/releases/download/v3.15.1/cmake-#{recipe.version}.tar.gz" +end + recipes << Recipe.new(context, "gmp", "6.1.2").tap do |recipe| recipe.sources << "https://gmplib.org/download/gmp/gmp-#{recipe.version}.tar.xz" end @@ -151,9 +300,14 @@ recipes << Recipe.new(context, "gcc", "9.1.0").tap do |recipe| recipe.dirname = "build" recipe.instructions.configure << %( + set -e; mkdir build; - cd build && ../gcc-#{recipe.version}/configure \ + cd build; + sed -e '/m64=/s/lib64/lib/' \ + -i.orig ../gcc-#{recipe.version}/gcc/config/i386/t-linux64; + ../gcc-#{recipe.version}/configure \ --prefix=/usr \ + --libdir=/usr/lib \ --disable-multilib \ --disable-libssp \ --disable-libmpx \ @@ -173,6 +327,7 @@ recipes << Recipe.new(context, "zsh", "5.7.1").tap do |recipe| recipe.url = "https://zsh.org" recipe.description = "Zsh is a shell designed for interactive use, although it is also a powerful scripting language." recipe.dependencies << "ncurses" + recipe.options["configure"] = "--with-tcsetpgrp" # Build-deps. #recipe.build_dependencies << "ncurses-dev" @@ -219,6 +374,8 @@ recipes << Recipe.new(context, "libyaml", "0.2.2").tap do |recipe| recipe.sources << "https://github.com/yaml/libyaml/archive/#{recipe.version}.tar.gz" recipe.instructions.configure << "cd libyaml-#{recipe.version} && ./bootstrap && ./configure --prefix=/usr" + + # recipe.build_dependencies << "autoconf" << "libtool" end # FIXME: This one will fail on non-x86_64 platforms. Also on non-linux @@ -255,7 +412,12 @@ end recipes << Recipe.new(context, "binutils", "2.32").tap do |recipe| recipe.sources << "https://ftp.gnu.org/gnu/binutils/binutils-#{recipe.version}.tar.xz" - recipe.instructions.install << "cd #{recipe.dirname} && make 'DESTDIR=#{recipe.fake_root_directory}' install && rm '#{recipe.fake_root_directory}/usr/bin/strings'" + recipe.options["configure"] = %( \ + --disable-multilib \ + --with-pic --disable-nls + ) + recipe.options["make"] = "tooldir=/usr" + recipe.instructions.install << "cd #{recipe.dirname} && make 'DESTDIR=#{recipe.fake_root_directory}' tooldir=/usr install && rm '#{recipe.fake_root_directory}/usr/bin/strings'" end recipes << Recipe.new(context, "readline", "8.0").tap do |recipe| @@ -287,30 +449,30 @@ selected_recipes = ARGV.map do |name| end if selected_recipes.any? &.is_a?(String) - puts "At least one of the requested recipes is not known." + puts "At least one of the requested recipes is not known." - selected_recipes.select! &.is_a?(String) - pp! selected_recipes -end - -# Getting rid of Strings. -selected_recipes = selected_recipes.compact_map do |recipe| - if recipe.is_a? String - nil - else - recipe + selected_recipes.select! &.is_a?(String) + pp! selected_recipes end -end -selected_recipes.each do |recipe| - pp recipe + # Getting rid of Strings. + selected_recipes = selected_recipes.compact_map do |recipe| + if recipe.is_a? String + nil + else + recipe + end + end - raise "oh no, download failed" unless recipe.download - raise "oh no, extraction failed" unless recipe.extract + selected_recipes.each do |recipe| + pp recipe - raise "oh no, build failed" unless recipe.build - raise "oh no, packaging failed" unless recipe.package + raise "oh no, download failed" unless recipe.download + raise "oh no, extraction failed" unless recipe.extract - recipe.clean -end + raise "oh no, build failed" unless recipe.build + raise "oh no, packaging failed" unless recipe.package + + recipe.clean + end