public abstract bool BuildLibrary(Package pkg, Library lib);
Beispiel #2
0
        public override bool BuildLibrary(Package pkg, Library lib)
        {
            ProcessStartInfo info = new ProcessStartInfo();

            string path = Config.PathFormat("{0}/{1}",
                cfg.source_path,
                lib.source_path);

            /* PlatformExt ignored for us */
            string binName = lib.binary_name;

            if (!lib.is_executable)
            {
                if (lib.has_platform_ext)
                {
                    binName += "_i486.so";
                }
                else
                {
                    binName += ".so";
                }
            }

            string output_folder = (lib.release_mode == ReleaseMode.ReleaseMode_Release) ? "Release" : "Debug";

            if (lib.build_mode == BuildMode.BuildMode_Episode2)
            {
                output_folder += ".orangebox";
            }
            else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
            {
                output_folder += ".original";
            }
            else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
            {
                output_folder += ".left4dead";
            }

            string binpath = Config.PathFormat("{0}/{1}/{2}",
                path,
                output_folder,
                binName);

            if (File.Exists(binpath))
            {
                File.Delete(binpath);
            }

            string makefile_args = "CPP=gcc-4.1 ";

            if (lib.build_mode == BuildMode.BuildMode_Episode1)
            {
            }
            else if (lib.build_mode == BuildMode.BuildMode_Episode2)
            {
                makefile_args += "ENGINE=\"orangebox\" ";
            }
            else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
            {
                makefile_args = "ENGINE=\"original\"";
            }
            else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
            {
                makefile_args = "ENGINE=\"left4dead\"";
            }

            /* Clean the project first */
            info.WorkingDirectory = path;
            info.FileName = cfg.builder_path;
            info.Arguments = makefile_args + " clean";
            info.UseShellExecute = false;

            Process p = Process.Start(info);
            p.WaitForExit();
            p.Close();

            /* Now build it */
            info.WorkingDirectory = path;
            info.FileName = cfg.builder_path;
            info.Arguments = makefile_args;
            info.UseShellExecute = false;

            if (cfg.build_options != null)
            {
                info.Arguments += " " + cfg.build_options;
            }

            p = Process.Start(info);
            p.WaitForExit();
            p.Close();

            if (!File.Exists(binpath))
            {
                return false;
            }

            path = Config.PathFormat("{0}/{1}/{2}/{3}",
                cfg.pkg_path,
                pkg.GetBaseFolder(),
                lib.package_path,
                binName);
            File.Copy(binpath, path, true);

            return true;
        }
        /**
         * Called to build libraries
         */
        public override Library[] GetLibraries()
        {
            if (libraries != null)
            {
                return (Library [])libraries.ToArray(typeof(Library));
            }

            libraries = new ArrayList();

            Library lib = new Library();
            lib.package_path = "addons/sourcemod/bin";
            lib.source_path = "loader";
            lib.binary_name = "sourcemod_mm";
            lib.vcproj_name = "loader";
            lib.build_mode = BuildMode.BuildMode_Simple;
            lib.has_platform_ext = true;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/bin";
            lib.source_path = "core";
            lib.binary_name = "sourcemod.1.ep1";
            lib.vcproj_name = "sourcemod_mm";
            lib.build_mode = BuildMode.BuildMode_OldMetamod;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/bin";
            lib.source_path = "core";
            lib.binary_name = "sourcemod.2.ep1";
            lib.vcproj_name = "sourcemod_mm";
            lib.build_mode = BuildMode.BuildMode_Episode1;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/bin";
            lib.source_path = "core";
            lib.binary_name = "sourcemod.2.ep2";
            lib.vcproj_name = "sourcemod_mm";
            lib.build_mode = BuildMode.BuildMode_Episode2;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/bin";
            lib.source_path = "sourcepawn/jit/x86";
            lib.binary_name = "sourcepawn.jit.x86";
            lib.vcproj_name = "jit-x86";
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/scripting";
            lib.source_path = "sourcepawn/compiler";
            lib.binary_name = "spcomp";
            lib.is_executable = true;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions";
            lib.source_path = "extensions/geoip";
            lib.binary_name = "geoip.ext";
            lib.vcproj_name = "geoip";
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions";
            lib.source_path = "extensions/bintools";
            lib.binary_name = "bintools.ext";
            lib.vcproj_name = "bintools";
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions";
            lib.source_path = "extensions/mysql";
            lib.binary_name = "dbi.mysql.ext";
            lib.vcproj_name = "sm_mysql";
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions/auto.1.ep1";
            lib.source_path = "extensions/sdktools";
            lib.binary_name = "sdktools.ext";
            lib.vcproj_name = "sdktools";
            lib.build_mode = BuildMode.BuildMode_OldMetamod;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions/auto.2.ep1";
            lib.source_path = "extensions/sdktools";
            lib.binary_name = "sdktools.ext";
            lib.vcproj_name = "sdktools";
            lib.build_mode = BuildMode.BuildMode_Episode1;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions/auto.2.ep2";
            lib.source_path = "extensions/sdktools";
            lib.binary_name = "sdktools.ext";
            lib.vcproj_name = "sdktools";
            lib.build_mode = BuildMode.BuildMode_Episode2;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions";
            lib.source_path = "extensions/sqlite";
            lib.binary_name = "dbi.sqlite.ext";
            lib.vcproj_name = "sm_sqlite";
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions/auto.1.ep1";
            lib.source_path = "extensions/cstrike";
            lib.binary_name = "game.cstrike.ext";
            lib.vcproj_name = "cstrike";
            lib.build_mode = BuildMode.BuildMode_OldMetamod;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions/auto.2.ep1";
            lib.source_path = "extensions/cstrike";
            lib.binary_name = "game.cstrike.ext";
            lib.vcproj_name = "cstrike";
            lib.build_mode = BuildMode.BuildMode_Episode1;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions";
            lib.source_path = "extensions/topmenus";
            lib.binary_name = "topmenus.ext";
            lib.vcproj_name = "topmenus";
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions/auto.2.ep2";
            lib.source_path = "extensions/tf2";
            lib.binary_name = "game.tf2.ext";
            lib.vcproj_name = "tf2";
            lib.build_mode = BuildMode.BuildMode_Episode2;
            libraries.Add(lib);

            lib = new Library();
            lib.package_path = "addons/sourcemod/extensions";
            lib.source_path = "extensions/regex";
            lib.binary_name = "regex.ext";
            lib.vcproj_name = "regex";
            libraries.Add(lib);

            return (Library [])libraries.ToArray(typeof(Library));
        }
Beispiel #4
0
        public override bool BuildLibrary(Package pkg, Library lib)
        {
            ProcessStartInfo info = new ProcessStartInfo();

            string path = Config.PathFormat("{0}/{1}/msvc9",
                cfg.source_path,
                lib.source_path);

            /* PlatformExt ignored for us */
            string binName = lib.binary_name + (lib.is_executable ? ".exe" : ".dll");

            string config_name = "Unknown";

            if (lib.release_mode == ReleaseMode.ReleaseMode_Release)
            {
                config_name = "Release";
            }
            else if (lib.release_mode == ReleaseMode.ReleaseMode_Debug)
            {
                config_name = "Debug";
            }

            if (lib.build_mode == BuildMode.BuildMode_DarkMessiah)
            {
                config_name = config_name + " - Dark Messiah";
            }
            if (lib.build_mode == BuildMode.BuildMode_Episode1)
            {
                config_name = config_name + " - Episode 1";
            }
            else if (lib.build_mode == BuildMode.BuildMode_Episode2)
            {
                config_name = config_name + " - Orange Box";
            }
            else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
            {
                config_name = config_name + " - Old Metamod";
            }
            else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
            {
                config_name = config_name + " - Left 4 Dead";
            }

            string binpath = Config.PathFormat("{0}/{1}/{2}",
                path,
                config_name,
                binName);

            if (File.Exists(binpath))
            {
                File.Delete(binpath);
            }

            string project_file = null;
            if (lib.vcproj_name != null)
            {
                project_file = lib.vcproj_name + ".vcproj";
            }
            else
            {
                project_file = lib.binary_name + ".vcproj";
            }

            info.WorkingDirectory = path;
            info.FileName = cfg.builder_path;
            info.UseShellExecute = false;
            info.RedirectStandardOutput = true;
            info.RedirectStandardError = true;

            if (cfg.build_options != null)
            {
                info.Arguments = cfg.build_options + " ";
            }

            info.Arguments += "/rebuild \"" + project_file + "\" \"" + config_name + "\"";

            Process p = Process.Start(info);
            Console.WriteLine(p.StandardOutput.ReadToEnd());
            p.WaitForExit();
            p.Close();

            if (!File.Exists(binpath))
            {
                return false;
            }

            path = Config.PathFormat("{0}/{1}/{2}/{3}",
                cfg.pkg_path,
                pkg.GetBaseFolder(),
                lib.package_path,
                binName);
            File.Copy(binpath, path, true);

            /* On Windows we optionally log the PDB path */
            if (!lib.is_executable && cfg.pdb_log_file != null)
            {
                FileStream fs = File.Open(cfg.pdb_log_file, FileMode.Append, FileAccess.Write);
                StreamWriter sw = new StreamWriter(fs);
                sw.WriteLine(binpath.Replace(".dll", ".pdb"));
                sw.Close();
            }

            return true;
        }
Beispiel #5
0
 static IEnumerable<string> MakeLibrary(
     Library libraryConfig, string src)
 {
     var name = libraryConfig.Name;
     var id = "boost_" + name;
     return new Library(
         id,
         src,
         CreatePackageList(
             name, src, libraryConfig.PackageList
         ).ToOptionalClass()
     ).
     Create();
 }