diff --git a/src/main.cr b/src/main.cr index 4dc6695..f99f52e 100644 --- a/src/main.cr +++ b/src/main.cr @@ -19,7 +19,7 @@ recipes << Recipe.new(context, "hello", "2.10").tap do |recipe| # Also, installing in /package makes testing with a real-life # package manager trivial and reduces the damage done in case # of… containment failure. ]:-> - recipe.instructions.configure << "cd hello-#{recipe.version} && ./configure --prefix=/package" + recipe.instructions.configure << "cd hello-#{recipe.version} && ./configure --prefix=/usr" recipe.url = "https://www.gnu.org/software/hello/" recipe.description = "The GNU Hello program produces a familiar, friendly greeting." @@ -32,6 +32,26 @@ recipes << Recipe.new(context, "hello", "2.10").tap do |recipe| #end 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" + + recipe.options["make"] = "LUAAPK= static" + + recipe.instructions.install << "mkdir -p '#{recipe.fake_root_directory}/sbin'" + recipe.instructions.install << "cp apk-tools-#{recipe.version}/src/apk.static '#{recipe.fake_root_directory}/sbin/apk'" + + [ + "/var/lib/apk", + "/var/cache/misc", + "/etc/apk/keys", + "/etc/apk/protected_paths.d" + ].each do |dir| + recipe.instructions.install << "mkdir -p '#{recipe.fake_root_directory}#{dir}'" + end + + #recipe.build_dependencies << "zlib-dev" << "openssl-dev" +end + # Be careful with that one. It’s not configured to use proper prefixes. # (Not sure that it should though. It’s gotta put things in /sbin anyway.) recipes << Recipe.new(context, "sysvinit", "2.95").tap do |recipe| @@ -48,20 +68,87 @@ recipes << Recipe.new(context, "musl", "1.1.23").tap do |recipe| recipe.description = "The musl c library (libc) implementation." end -recipes << Recipe.new(context, "llvm", "6.0.1").tap do |recipe| - recipe.sources << "http://releases.llvm.org/6.0.1/llvm-#{recipe.version}.src.tar.xz" - recipe.url = "http://llvm.org" - recipe.description = "The LLVM Project is a collection of modular and reusable compiler and toolchain technologies." +recipes << Recipe.new(context, "libffi", "3.2.1").tap do |recipe| + recipe.sources << "ftp://sourceware.org/pub/libffi/libffi-#{recipe.version}.tar.gz" +end - # Build-deps. - #recipe.build_dependencies << "cmake" - #recipe.build_dependencies << "make" +[{"6", "6.0.1"}, {"7", "7.1.0"},{"8", "8.0.0"}].each do |branch, version| + recipes << Recipe.new(context, "llvm-#{branch}", version).tap do |recipe| + recipe.sources << "http://releases.llvm.org/#{recipe.version}/llvm-#{recipe.version}.src.tar.xz" + recipe.url = "http://llvm.org" + recipe.description = "The LLVM Project is a collection of modular and reusable compiler and toolchain technologies." - recipe.instructions.configure << "mkdir #{recipe.name}-#{recipe.version}" - recipe.instructions.configure << "cd #{recipe.name}-#{recipe.version} && cmake ../llvm-#{recipe.version}.src -DCMAKE_INSTALL_PREFIX=/package -DCMAKE_BUILD_TYPE=Release" - - recipe.instructions.build << "pwd && ls && cd #{recipe.name}-#{recipe.version} && make" - recipe.instructions.install << "cd #{recipe.name}-#{recipe.version} && make DESTDIR='#{recipe.fake_root_directory}' install" + recipe.dependencies << "libffi" + + # Build-deps. + #recipe.build_dependencies << "cmake" + #recipe.build_dependencies << "make" + #recipe.build_dependencies << "libffi-dev" + #recipe.build_dependencies << "musl-dev" + + recipe.instructions.configure << "mkdir #{recipe.name}-#{recipe.version}" + # FIXME: BROKEN + recipe.instructions.configure << <<-EOF + cd #{recipe.name}-#{recipe.version} && \ + cmake ../llvm-#{recipe.version}.src \ + -DCMAKE_INSTALL_PREFIX=/usr/bad/llvm-#{branch} \ + -DLLVM_BUILD_DOCS=OFF \ + -DLLVM_BUILD_EXAMPLES=OFF \ + -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_ENABLE_ASSERTIONS=OFF \ + -DLLVM_ENABLE_CXX1Y=ON \ + -DLLVM_ENABLE_FFI=ON \ + -DLLVM_ENABLE_LIBCXX=OFF \ + -DLLVM_ENABLE_PIC=ON \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_SPHINX=OFF \ + -DLLVM_ENABLE_TERMINFO=ON \ + -DLLVM_ENABLE_ZLIB=ON \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DCMAKE_BUILD_TYPE=Release +EOF + + recipe.instructions.build << "pwd && ls && cd #{recipe.name}-#{recipe.version} && make" + recipe.instructions.install << "cd #{recipe.name}-#{recipe.version} && make DESTDIR='#{recipe.fake_root_directory}' install" + end +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 + +recipes << Recipe.new(context, "mpfr", "4.0.2").tap do |recipe| + recipe.sources << "https://www.mpfr.org/mpfr-current/mpfr-#{recipe.version}.tar.xz" +end + +recipes << Recipe.new(context, "mpc", "1.1.0").tap do |recipe| + recipe.sources << "https://ftp.gnu.org/gnu/mpc/mpc-#{recipe.version}.tar.gz" +end + +recipes << Recipe.new(context, "gcc", "9.1.0").tap do |recipe| + recipe.sources << "https://ftp.gnu.org/gnu/gcc/gcc-9.1.0/gcc-#{recipe.version}.tar.xz" + + recipe.dependencies << "gmp" << "mpfr" << "mpc" << "binutils" + + recipe.dirname = "build" + recipe.instructions.configure << %( + mkdir build; + cd build && ../gcc-#{recipe.version}/configure \ + --prefix=/usr \ + --disable-multilib \ + --disable-libssp \ + --disable-libmpx \ + --disable-libmudflap \ + --disable-libsanitizer \ + --disable-nls \ + --disable-werror \ + --enable-languages=c,c++ \ + --target=x86_64-junk-linux-musl \ + --build=x86_64-junk-linux-musl \ + --host=x86_64-junk-linux-musl + ) end recipes << Recipe.new(context, "zsh", "5.7.1").tap do |recipe| @@ -77,6 +164,12 @@ end recipes << Recipe.new(context, "ncurses", "6.1").tap do |recipe| recipe.sources << "ftp://ftp.invisible-island.net/ncurses/ncurses-#{recipe.version}.tar.gz" recipe.url = "https://www.gnu.org/software/ncurses/" + recipe.options["configure"] = "--enable-widec --without-ada --with-shared --enable-pc-files --disable-termcap" + + recipe.instructions.install << "cd ncurses-#{recipe.version} && make 'DESTDIR=#{recipe.fake_root_directory}' install" + + # Already provided bu busybox. + recipe.instructions.install << "cd '#{recipe.fake_root_directory}' && rm usr/bin/clear usr/bin/reset" end recipes << Recipe.new(context, "busybox", "1.31.0").tap do |recipe| @@ -84,9 +177,12 @@ recipes << Recipe.new(context, "busybox", "1.31.0").tap do |recipe| recipe.instructions.configure << "cd busybox-#{recipe.version} && make defconfig" recipe.instructions.configure << "sed -i -e 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' busybox-#{recipe.version}/.config" - recipe.instructions.install << "mkdir -p '#{recipe.fake_root_directory}/package/bin'" - recipe.instructions.install << "cp busybox-#{recipe.version}/busybox '#{recipe.fake_root_directory}/package/bin/busybox'" - recipe.instructions.install << "chroot '#{recipe.fake_root_directory}' /package/bin/busybox --install -s /package" + recipe.instructions.install << "mkdir -p '#{recipe.fake_root_directory}/bin'" + recipe.instructions.install << "mkdir -p '#{recipe.fake_root_directory}/sbin'" + recipe.instructions.install << "mkdir -p '#{recipe.fake_root_directory}/usr/bin'" + recipe.instructions.install << "mkdir -p '#{recipe.fake_root_directory}/usr/sbin'" + recipe.instructions.install << "cp busybox-#{recipe.version}/busybox '#{recipe.fake_root_directory}/bin/busybox'" + recipe.instructions.install << "chroot '#{recipe.fake_root_directory}' /bin/busybox --install -s" #recipe.build_dependencies << "linux-dev" end @@ -102,6 +198,59 @@ recipes << Recipe.new(context, "rc", "0.0.1").tap do |recipe| recipe.instructions.install << "cp rc/* '#{recipe.fake_root_directory}/etc/'" end +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" +end + +# FIXME: This one will fail on non-x86_64 platforms. Also on non-linux +# platforms. This build script is total shit. +recipes << Recipe.new(context, "openssl", "1.1.1c").tap do |recipe| + recipe.sources << "https://www.openssl.org/source/openssl-#{recipe.version}.tar.gz" + + recipe.instructions.configure << "cd openssl-#{recipe.version} && ./Configure --prefix=/usr linux-x86_64" +end + +recipes << Recipe.new(context, "libevent", "2.1.10").tap do |recipe| + recipe.sources << "https://github.com/libevent/libevent/releases/download/release-#{recipe.version}-stable/libevent-#{recipe.version}-stable.tar.gz" + + recipe.dirname = "libevent-#{recipe.version}-stable" +end + +recipes << Recipe.new(context, "pcre2", "10.33").tap do |recipe| + recipe.sources << "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-#{recipe.version}.tar.gz" +end + +recipes << Recipe.new(context, "pcre", "8.43").tap do |recipe| + recipe.sources << "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-#{recipe.version}.tar.gz" +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'" +end + +recipes << Recipe.new(context, "readline", "8.0").tap do |recipe| + recipe.sources << "ftp://ftp.gnu.org/gnu/readline/readline-#{recipe.version}.tar.gz" +end + +recipes << Recipe.new(context, "gc", "8.0.4").tap do |recipe| + recipe.sources << "https://github.com/ivmai/bdwgc/releases/download/v#{recipe.version}/gc-#{recipe.version}.tar.gz" +end + +recipes << Recipe.new(context, "clang", "8.0.1").tap do |recipe| + recipe.sources << "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{recipe.version}/cfe-#{recipe.version}.src.tar.xz" + recipe.dirname = "build" + + recipe.instructions.configure << "mkdir build && cd build && cmake ../cfe-#{recipe.version}.src -DCMAKE_PREFIX_PATH=/usr/bad/llvm-8 -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release" +end + +recipes << Recipe.new(context, "service", "0.0.1").tap do |recipe| + recipe.sources << "" # FIXME +end + if ARGV.size == 0 || ARGV[0]? == "-h" pp recipes.map &.name exit 0