def __setup(self):
        """Construct the series of shell commands, i.e., fill in
           self.__commands"""

        tarball = 'v{}.tar.gz'.format(self.__version)
        url = '{0}/{1}'.format(self.__baseurl, tarball)

        # Download source from web
        self.__commands.append(self.download_step(url=url, directory=self.__wd))

        # Charm++ does not install nicely into a separate directory,
        # even with "--destination".  So just untar it into the
        # destination directory prefix.
        self.__commands.append(self.untar_step(
            tarball=posixpath.join(self.__wd, tarball),
            directory=self.__prefix))

        # Charm++ is hard-coded to use pgCC rather than pgc++ when the
        # PGI compiler is selected.  Replace pgCC with pgc++.
        # But... PGI is not really supported by Charm++:
        # https://charm.cs.illinois.edu/redmine/issues/234
        if 'pgcc' in self.__options:
            self.__commands.append(
                self.sed_step(
                    file=posixpath.join(self.__installdir, 'src', 'arch',
                                        'common', 'cc-pgcc.sh'),
                    patterns=[r's/pgCC/pgc++/g']))

        # Construct options string
        options = []
        if self.__options:
            options.extend(self.__options)
        if self.__basedir:
            options.extend(['--basedir={}'.format(x) for x in self.__basedir])

        # Build
        self.__commands.append('cd {} && ./build {} {} {} -j{}'.format(
            self.__installdir, self.__target, self.__target_architecture,
            ' '.join(options), self.__parallel))

        # Set library path
        libpath = posixpath.join(self.__installdir, 'lib_so')
        if self.ldconfig:
            self.__commands.append(self.ldcache_step(directory=libpath))
        else:
            self.environment_variables['LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format(libpath)

        # Check the build
        if self.__check:
            self.__commands.append('cd {} && make test'.format(
                posixpath.join(self.__installdir, 'tests', 'charm++')))

        # Cleanup tarball and directory
        self.__commands.append(self.cleanup_step(
            items=[posixpath.join(self.__wd, tarball)]))

        # Set the environment
        self.environment_variables['CHARMBASE'] = self.__installdir
        self.environment_variables['PATH'] = '{}:$PATH'.format(
            posixpath.join(self.__installdir, 'bin'))
Construct the series of shell commands, i.e., fill in
           self.__commands
hpccm/building_blocks/charm.py