def check_coreutils(): make('NON_ROOT_USERNAME=nobody', 'check-root') # Fix some permissions so that the non-root user can compile and run the tests stdlib.cmd('chown -Rv nobody .') stdlib.cmd( 'su nobody -s /bin/bash -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"', fail_ok=True)
def build(build): packages = autotools.build( configure=lambda: configure( '--with-ncurses', '--enable-multibyte',{downarrow}, compile=lambda: make('SHLIB_LIBS=-lncursesw'), # Ensures readline is linked against the libncursesw library install=lambda: make('install', 'SHLIB_LIBS=-lncursesw', f'DESTDIR={{}build.install_cache{}}'),{downarrow} # Drain examples in readline-dev packages['sys-libs/readline-dev'].drain(
def build(build): packages = autotools.build( configure=lambda: configure(make_configure=lambda: make('configure'), ), compile=lambda: make('all'), split=drain_all_with_doc, ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['dev-apps/git'].requires('raven-os/corefs') return packages
def patch_bzip2(): # Apply all patches stdlib.patch.patch_all() # Ensure the installation of symbolic links are relative stdlib.cmd("sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\\1@' Makefile") # Ensure the man pages are installed into the correct location stdlib.cmd("sed -i 's@(PREFIX)/man@(PREFIX)/share/man@g' Makefile") # Clean the installation and use a different Makefile than the default one stdlib.cmd('make -f Makefile-libbz2_so') make('clean')
def install_gcc(): build = stdlib.build.current_build() target = os.environ['TARGET'] # Install the main components of gcc and g++ make('install', f'DESTDIR={build.install_cache}') # Compatibility symlink to enable building programs with Link Time Optimization #stdlib.cmd(f'install -v -dm755 {build.install_cache}/usr/lib64/bfd-plugins') with stdlib.pushd(build.install_cache): os.makedirs('usr/lib64/bfd-plugins/', exist_ok=True) os.symlink(f'../gcc/{target}/8.2.0/liblto_plugin.so', 'usr/lib64/bfd-plugins/liblto_plugin.so')
def build(build): packages = autotools.build( patch=patch_gmp, configure=lambda: stdlib.cmd(f'''\ ./configure \\ --enable-cxx \\ --enable-shared \\ --enable-static \\ {' '.join(stdlib.template.configure.get_dir_flags())} \\ --infodir="/usr/share/info/gmp/" \\ --docdir="/usr/share/doc/" \\ '''), install=lambda: make( 'install', 'install-html', f'DESTDIR={stdlib.build.current_build().install_cache}'), ) # Rename documentation directory to match the other packages. packages['sys-libs/gmp-doc'].move('usr/share/doc/gmp.html', 'usr/share/doc/gmp') # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-libs/gmp'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( configure=lambda: configure( '--with-system-expat', '--with-system-ffi', '--without-ensurepip', '--enable-optimizations', ), split=drain_all_with_doc, install=lambda: make('altinstall', f'DESTDIR={build.install_cache}'), ) # Make it executable with stdlib.pushd(packages['dev-lang/python'].wrap_cache): os.chmod(f'usr/lib64/libpython{build.major}.{build.minor}m.so', 0o0755) os.chmod(f'usr/lib64/libpython{build.major}.so', 0o0755) # Make the python -> python3 symlink packages['dev-lang/python'].make_symlink(f'python{build.major}', 'usr/bin/python') packages['dev-lang/python'].make_symlink( f'python{build.major}.{build.minor}', f'usr/bin/python{build.major}') # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['dev-lang/python'].requires('raven-os/corefs') return packages
def build(build): # TODO FIXME We should create a Perl template when a sufficient amount of # packets will be built this way (providing enough information to make a solid # perl template) # # We're doing it manually in the meantime # - Septembre 2019 packages = autotools.build( configure=lambda: stdlib.cmd('perl Makefile.PL'), check=lambda: make('test', fail_ok=True), ) packages['dev-perl/xml-parser'].drain('usr/lib/perl5/') # We don't want -dev alternatives if they add nothing but mans for perl modules. packages['dev-perl/xml-parser'].drain_package( packages['dev-perl/xml-parser-dev'], '*', ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['dev-perl/xml-parser'].requires('raven-os/corefs') return packages
def build(build): # Ensures Perl uses the system's zlib and bzip2 libraries. os.environ['BUILD_ZLIB'] = 'False' os.environ['BUILD_BZIP2'] = '0' packages = autotools.build(configure=lambda: stdlib.cmd(f'''sh Configure \ -des \ -Dprefix=/usr \ -Dvendorprefix=/usr \ -Dman1dir=/usr/share/man/man1 \ -Dman3dir=/usr/share/man/man3 \ -Dman1ext=1perl \ -Dman3ext=3perl \ -Dpager="/usr/bin/less -isR" \ -Duseshrplib \ -Dusethreads \ '''), split=split_perl, check=lambda: make('-k', 'check', fail_ok=True)) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['dev-lang/perl'].requires('raven-os/corefs') return packages
def build(build): return basic.build( build_folder='build', configure=lambda: cmake('-DFREEGLUT_BUILD_DEMOS=OFF', folder='..'), compile=make, install=lambda: make('install') )
def build(build): # TODO: # - Include the configuration in /boot/ # - Symlink or rename vmlinuz to vmlinuz-X.Y.Z. packages = basic.build( configure=lambda: make('olddefconfig'), compile=make, install=install_linux, deplinker=None, ) packages['kernel/linux'].drain( 'usr/lib/*', 'boot/*', ) # Remove useless files with stdlib.pushd(packages['kernel/linux'].wrap_cache): stdlib.cmd( f'find \\( -name .install -o -name ..install.cmd \\) -delete') # Drain documentation packages['kernel/linux-doc'].drain_build_cache('Documentation/*', 'usr/doc/linux/') # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['kernel/linux'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( check=lambda: make('-j1', 'check'), # Tests are known to fail if run simultaneously ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-libs/gperf'].requires('raven-os/corefs') return packages
def build(build): packages = basic.build(build_folder='build', configure=lambda: cmake(folder='..'), compile=make, install=lambda: make('install')) packages['dev-libs/graphite2-dev'].drain('usr/local/{share,include}/', 'usr/share/graphite2/*.cmake') return packages
def build(build): packages = autotools.build( configure=lambda: stdlib.cmd('''./config \ --prefix=/usr \ --openssldir=/etc/ssl \ --libdir=lib \ shared \ zlib-dynamic \ '''), check=lambda: make('test', fail_ok=True), install=lambda: make('install', 'MANSUFFIX=ssl', f'DESTDIR={stdlib.build.current_build().install_cache}'), split=split_openssl, ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-libs/openssl'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( check=lambda: make(f'PERL5LIB={os.getcwd()}/tests', 'check'), split=drain_all_with_doc, ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['dev-apps/make'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( configure=lambda: configure( '--with-ncurses', '--enable-multibyte', ), compile=lambda: make('SHLIB_LIBS=-lncursesw' ), # Ensures readline is linked against the libncursesw library install=lambda: make('install', 'SHLIB_LIBS=-lncursesw', f'DESTDIR={build.install_cache}'), ) # Drain examples in readline-dev packages['sys-libs/readline-dev'].drain('usr/share/readline/*.c', ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-libs/readline'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( patch=patch_sed, install=lambda: make('install', 'install-html', f'DESTDIR="{build.install_cache}"'), ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-apps/sed'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( install=lambda: make( 'install', 'install-tex', f'DESTDIR={stdlib.build.current_build().install_cache}', 'TEXMF=/usr/share/texmf'), split=drain_all_with_doc, ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-apps/texinfo'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( patch=patch_bzip2, configure=None, install=lambda: make('install', f'PREFIX={stdlib.build.current_build().install_cache}/usr/'), check=None, # Tests are already run when compiling split=split_bzip2, ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-apps/bzip2'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( configure=lambda: configure('--enable-thread-safe', '--infodir="/usr/share/info/mpfr/"', '--docdir="/usr/share/doc/"'), install=lambda: make( 'install', 'install-html', f'DESTDIR={stdlib.build.current_build().install_cache}'), ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-libs/mpfr'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( configure=None, install=lambda: make('RAISE_SETFCAP=no', 'prefix=/usr', f'DESTDIR={build.install_cache}/', 'install'), ) # Fix some permissions with stdlib.pushd(packages['sys-libs/libcap'].wrap_cache): for lib in glob.glob('usr/lib/libcap.so.*'): os.chmod(lib, 0o755) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-libs/libcap'].requires('raven-os/corefs') return packages
def install_linux(): build = stdlib.build.current_build() boot_dir = f'{build.install_cache}/boot' usr_dir = f'{build.install_cache}/usr' os.makedirs(boot_dir) os.makedirs(usr_dir) make('install', f'INSTALL_PATH={boot_dir}/') make('modules_install', f'INSTALL_MOD_PATH={usr_dir}/') make('headers_install', f'INSTALL_HDR_PATH={usr_dir}/')
def build(build): packages = basic.build( configure=lambda: stdlib.cmd( "./bootstrap --prefix=/usr \ --system-libs \ --mandir=/share/man \ --no-system-jsoncpp \ --no-system-librhash \ --docdir=/share/doc/cmake-3.15.5" ), compile=make, install=lambda: make('install', f'DESTDIR={build.install_cache}'), ) packages['dev-apps/cmake'].drain( 'usr/share/cmake-3.15/' ) return packages
def build(build): # TODO FIXME Install only libelf packages = autotools.build( install=lambda: make('install', f'DESTDIR={stdlib.build.current_build().install_cache}', folder='libelf'), split=drain_all_with_doc, ) # Manually install missing PC files packages['dev-apps/elfutils'].drain_build_cache( 'config/libelf.pc', 'usr/lib/pkgconfig/' ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['dev-apps/elfutils'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( configure=lambda: configure( '--infodir="/usr/share/info/mpc/"', '--docdir="/usr/share/doc/"', ), install=lambda: make( 'install', 'install-html', f'DESTDIR={stdlib.build.current_build().install_cache}'), ) # Rename documentation directory to match the other packages. packages['sys-libs/mpc-doc'].move('usr/share/doc/mpc.html', 'usr/share/doc/mpc') # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-libs/mpc'].requires('raven-os/corefs') return packages
def build(build): packages = autotools.build( configure=lambda: configure( '--enable-elf-shlibs', '--disable-libblkid', '--disable-libuuid', '--disable-uuidd', '--disable-fsck', ), install=lambda: make('install', 'install-libs', f'DESTDIR={stdlib.build.current_build().install_cache}'), ) packages['sys-apps/e2fsprogs'].drain( 'usr/share/*/*.awk', 'usr/share/*/*.sed', 'usr/lib64/*', ) # Packages member of `raven-os/essentials` should explicitly state all # of their dependencies, including indirect ones. packages['sys-apps/e2fsprogs'].requires('raven-os/corefs') return packages
def install_glibc(): build = stdlib.build.current_build() # TODO FIXME Temporary fix to avoid a harmless failure while installing glibc stdlib.cmd( "sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile") # Install glibc make('install') # Install locales make('localedata/install-locales') # Compile all timezone data with stdlib.pushd(build.install_cache): tzdata = f'{build.build_cache}/tzdata/' zic = f'{build.install_cache}/usr/sbin/zic' os.makedirs('usr/share/zoneinfo/posix', exist_ok=True) os.makedirs('usr/share/zoneinfo/right', exist_ok=True) for tz in [ 'etcetera', 'southamerica', 'northamerica', 'europe', 'africa', 'antarctica', 'asia', 'australasia', 'backward', 'pacificnew', 'systemv' ]: stdlib.cmd( f'{zic} -L /dev/null -d usr/share/zoneinfo {tzdata}/{tz}') stdlib.cmd( f'{zic} -L /dev/null -d usr/share/zoneinfo/posix {tzdata}/{tz}' ) stdlib.cmd( f'{zic} -L {tzdata}/leapseconds -d usr/share/zoneinfo/right {tzdata}/{tz}' ) stdlib.cmd(f'{zic} -d usr/share/zoneinfo -p America/New_York') shutil.copy(f'{tzdata}/zone.tab', 'usr/share/zoneinfo/') shutil.copy(f'{tzdata}/zone1970.tab', 'usr/share/zoneinfo/') shutil.copy(f'{tzdata}/iso3166.tab', 'usr/share/zoneinfo/') # Setup default configuration files with stdlib.pushd(build.install_cache): # /etc/nsswitch.conf with open('etc/nsswitch.conf', 'w+') as conf: conf.write( dedent('''\ # # Raven-OS - /etc/nsswitch.conf # passwd: compat files group: compat files shadow: compat files hosts: files dns networks: files dns services: db files protocols: db files rpc: db files ethers: db files netmasks: files netgroup: files bootparams: files automount: files aliases: files ''')) # /etc/ld.so.conf with open('etc/ld.so.conf', 'w+') as ld_conf: ld_conf.write( dedent(''' # # Raven-OS - /etc/ld.so.conf # include /etc/ld.so.conf.d/*.conf /usr/local/lib /opt/lib '''))
def build(build): # TODO FIXME del os.environ['CFLAGS'] del os.environ['CXXFLAGS'] del os.environ['LDFLAGS'] # stdlib.fetch.fetch() # stdlib.extract.flat_extract_all() # stdlib.patch.patch_all() packages = autotools.build_all( compilations=[ { 'configure': lambda: configure( '--disable-efiemu', '--with-platform=pc', ), }, { 'clean_before': lambda: make('clean'), 'configure': lambda: configure( '--disable-efiemu', '--with-platform=efi', ), } ], split=drain_all_with_doc, ) # common_conf = [ # '--disable-efiemu', # ] # # Run once for each target # autotools.build( # fetch=None, # extract=None, # patch=None, # configure=lambda: configure( # *common_conf, # '--with-platform=pc', # ), # split=None, # deplinker=None, # ) # make('clean') # packages = autotools.build( # fetch=None, # extract=None, # patch=None, # configure=lambda: configure( # *common_conf, # '--with-platform=efi', # ), # split=drain_all_with_doc, # ) # # Move a file to a more typical location # packages['sys-apps/grub'].move('etc/bash_completion.d/grub', 'usr/share/bash-completion/completions/') # # Packages member of `raven-os/essentials` should explicitly state all # # of their dependencies, including indirect ones. # packages['sys-apps/grub'].requires('raven-os/corefs') return packages
def build( build_folder='.', fetch=stdlib.fetch.fetch, extract=stdlib.extract.flat_extract_all, patch=stdlib.patch.patch_all, configure=configure, compile=make, check=lambda: make('check', fail_ok=True), install=lambda: make('install', f'DESTDIR={stdlib.build.current_build().install_cache}'), split=stdlib.split.system.system, deplinker=stdlib.deplinker.elf.elf_deplinker, ): """Download, build and wrap a library based on ``autoconf`` and ``make``. This exhaustive template is made of 9 steps: * ``fetch`` * ``extract`` * ``patch`` * ``configure`` * ``compile`` * ``check`` * ``install`` * ``split`` * ``dependency linking`` For each one of these steps, a function is called. This template simply calls each of them in the above order. All of these functions can be given as arguments, but each one of them has a default value that is explained below. If any of those functions is ``None``, the step is skipped. **Fetch** This step is used to download the source code. The default value is :py:func:`.fetch` with no argument. **Extract** This step is used to extract the downloaded source code. The default value is :py:func:`.flat_extract_all` with no argument. **Patch** This step is used to patch the downloaded source code. The default value is :py:func:`.patch_all` with no argument. From now on, the current working directory is changed in favor of ``build_folder`` (which defaults to ``.``). If the directory pointed by ``build_folder`` doesn't exist, it is created. This is useful for the few ``configure`` scripts that don't work if they aren't executed in a standalone directory. **Configure** This step uses the ``configure`` script to configure the source code. The default value is :py:func:`.configure` with no argument. When ``build_folder`` isn't ``.``, it is usually necessary to override this step with an other call to :py:func:`.configure` with the argument ``binary='../configure'``. **Compile** This step compiles the source code. The default value is :py:func:`.make` with no argument. **Check** This step runs the unit and integration tests. The default value is :py:func:`.make` with the arguments ``'check'`` and ``fail_ok=True``. **Install** This step installs the software in the install cache. The default value is :py:func:`.make` with the arguments ``'install'`` and ``f'DESTDIR={stdlib.build.current_build().install_cache}'`` If this step is overriden, the ``DESTDIR`` variable is crucial and should be reused. Otherwise, and unless the ``configure`` script has been configured to work without it, the installation can damage and overwrite parts of the host system. **Split** This step automatically splits the output of the build into multiple packages. The default value is :py:func:`~stdlib.split.system.system`. Alternative splitters can be found in the :py:mod:`~stdlib.split` module. **Dependency Linking** This step automatically finds requirements for the generated packages. The default value is :py:func:`~stdlib.deplinker.elf.elf_deplinker`. Alternative dependency linkers can be found in the :py:mod:`~stdlib.deplinker` module. """ build = stdlib.build.current_build() stdlib.log.ilog("Step 1/9: Fetch") if fetch is not None: with stdlib.log.pushlog(): fetch() stdlib.log.ilog("Step 2/9: Extract") if extract is not None: with stdlib.log.pushlog(): extract() stdlib.log.ilog("Step 3/9: Patch") if patch is not None: with stdlib.log.pushlog(): patch() packages = dict() os.makedirs(build_folder, exist_ok=True) with stdlib.pushd(build_folder): os.environ['DESTDIR'] = build.install_cache stdlib.log.ilog("Step 4/9: Configure") if configure is not None: with stdlib.log.pushlog(): configure() stdlib.log.ilog("Step 5/9: Compile") if compile is not None: with stdlib.log.pushlog(): compile() stdlib.log.ilog("Step 6/9: Check") if check is not None: with stdlib.log.pushlog(): check() stdlib.log.ilog("Step 7/9: Install") if install is not None: with stdlib.log.pushlog(): install() stdlib.log.ilog("Step 8/9: Split") if split is not None: with stdlib.log.pushlog(): packages = split() if len(packages) > 0: stdlib.log.ilog("The following packages were generated:") with stdlib.log.pushlog(): for package in packages.values(): stdlib.log.ilog(str(package)) stdlib.log.ilog("Step 9/9: Dependency Linking") if deplinker is not None: with stdlib.log.pushlog(): deplinker(packages) return packages
def install_tar(): make('install', f'DESTDIR={stdlib.build.current_build().install_cache}'), make('install-html', f'docdir=/usr/share/doc/tar/', folder='doc')