Skip to content

Commit

Permalink
Migrated to alire
Browse files Browse the repository at this point in the history
AJ-Ianozi committed Jun 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 7050615 commit 1728e7d
Showing 4 changed files with 96 additions and 53 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -2,3 +2,20 @@ bin
obj
tests/driver/test_runner
docs/user/_output
/obj/
/bin/
/alire/
/config/
.DS_Store
Thumbs.db
*~
.fuse_hidden*
.directory
.Trash-*
.nfs*
*.cab
*.msi
*.msix
*.msm
*.msp
*.code-workspace
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -20,6 +20,15 @@ care about it.

## Build from sources

### Using alire

If all goes will this will be in the alire index soon. For now, you can build
via `alr update && alr build`

This should automatically pull all of the dependencies in, including libcmark.

### Using gprbuild

To build you need:

* compiler: GCC with enabled Ada support or GNAT from:
@@ -71,6 +80,9 @@ debug mode the program may have problems with finding all dependencies.

### Build unit tests

**Note:** Unit tests are currently being migrated to aunit and alire so this may
not work as expected.

Navigate to `tests/driver` directory from the main directory (where this
file is):

30 changes: 30 additions & 0 deletions alire.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name = "yass"
description = "Static website generator"
version = "3.1.0-dev"

authors = ["AJ Ianozi"]
maintainers = ["AJ Ianozi <[email protected]>"]
maintainers-logins = ["AJ-Ianozi"]
licenses = "GPL-3.0-or-later"
website = "https://yass.website"
tags = ["web", "markdown", "generator"]

executables = ["yass"]


[gpr-externals]
YASS_OS = ["Windows", "Unix"]
Mode = ["dev", "debug", "release", "analyze"]

[gpr-set-externals]
Mode = "release"

[gpr-set-externals.'case(os)']
windows = { YASS_OS = "Windows" }
'...' = { YASS_OS = "Unix" }

[[depends-on]]
aws = "^24.0.0"
xmlada = "^24.0.0"
gnatcoll = "^24.0.0"
libcmark = ">=0.0.1"
90 changes: 37 additions & 53 deletions yass.gpr
Original file line number Diff line number Diff line change
@@ -1,44 +1,31 @@
with "aws";
with "xmlada";
with "config/yass_config.gpr";
project Yass is

project yass is
for Source_Dirs use ("src/", "config/");
for Object_Dir use "obj/" & Yass_Config.Build_Profile;
for Create_Missing_Dirs use "True";
for Exec_Dir use "bin";
for Main use ("yass.adb");

for Main use ("yass.adb");
for Source_Dirs use ("src/**");
for Object_Dir use "obj";
for Exec_Dir use "bin";
type Mode_Type is ("dev", "debug", "release", "analyze");
Mode : Mode_Type := external ("Mode", "dev");

for Create_Missing_Dirs use "True";
type OS_Type is ("Windows", "Unix");
OS : OS_Type := external ("YASS_OS", "Unix");

type Mode_Type is ("dev", "debug", "release", "analyze");
Mode : Mode_Type := external ("Mode", "dev");

type OS_Type is ("Windows", "Unix");
OS : OS_Type := external ("OS", "Unix");

package Builder is
package Builder is
case Mode is
when "release" =>
for Default_Switches("ada") use ("-j0", "-gnat2012");
when others =>
for Default_Switches("ada") use ("-j0", "-gnat2012", "-g");
for Global_Configuration_Pragmas use "gnat.adc";
end case;
end Builder;

package Binder is
case Mode is
when "dev" =>
for Default_Switches ("Ada") use ("-E");
when "debug" | "analyze" =>
for Default_Switches("ada") use ("-E", "-shared");
when "release" =>
for Default_Switches("ada") use ("-static");
end case;
end Binder;
end Builder;

package Compiler is
case Mode is
package Compiler is
for Default_Switches ("Ada") use Yass_Config.Ada_Compiler_Switches;
case Mode is
when "dev" | "debug" =>
for Default_Switches ("ada") use ("-gnatwa",
"-fstack-check",
@@ -59,51 +46,48 @@ project yass is
"-fprofile-arcs",
"-ftest-coverage");
end case;
end Compiler;
end Compiler;


package Linker is
package Linker is
Release_Switches := ("-Wl,--gc-sections",
"-s",
"-O2",
"-lcmark",
"-flto");
case Mode is
when "dev" =>
when "dev" | "release" =>
for Default_Switches ("Ada") use ("-lcmark");
when "debug" =>
for Default_Switches ("ada") use ("-no-pie", "-lcmark");
when "release" =>
case OS is
when "Windows" =>
for Default_Switches ("ada") use Release_Switches &
"-L/opt/lib";
when "Unix" =>
for Default_Switches ("ada") use Release_Switches &
"-Wl,-rpath,$ORIGIN/../lib";
end case;
when "analyze" =>
for Default_Switches ("ada") use ("-no-pie",
"-pg",
"-fprofile-arcs",
"-lcmark");
end case;
end Linker;
end Linker;

package Pretty_Printer is
package Pretty_Printer is
for Default_Switches("ada") use ("--RM-style-spacing",
"--no-separate-loop-then",
"--no-separate-is",
"-rnb",
"-c0");
end Pretty_Printer;
end Pretty_Printer;

-- Unit tests on hold until ported to alire
-- package GnatTest is
-- for Tests_Dir use "../tests";
-- for Harness_Dir use "../tests/driver";
-- for GnatTest_Switches use ("--omit-sloc",
-- "--test-case-only",
-- "--passed-tests=hide",
-- "--exit-status=on");
-- end GnatTest;

package GnatTest is
for Tests_Dir use "../tests";
for Harness_Dir use "../tests/driver";
for GnatTest_Switches use ("--omit-sloc",
"--test-case-only",
"--passed-tests=hide",
"--exit-status=on");
end GnatTest;
package Install is
for Artifacts (".") use ("share");
end Install;

end yass;
end Yass;

0 comments on commit 1728e7d

Please sign in to comment.