Skip to content

Commit

Permalink
New script to create a source package
Browse files Browse the repository at this point in the history
TN: TA19-011
  • Loading branch information
pmderodat committed Oct 19, 2020
1 parent 6e859cb commit 04b7560
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
24 changes: 24 additions & 0 deletions utils/libadalang.gpr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--- libadalang.gpr.old
+++ libadalang.gpr
@@ -25,10 +25,7 @@ library project Libadalang is
Enable_Warnings : Boolean :=
external ("LIBADALANG_WARNINGS", "false");

- Primary_Source_Dirs :=
- ("/tmp/libadalang-21.0.0/include/libadalang", "/tmp/lal-21.0.0/ada/extensions/src");
-
- for Source_Dirs use Primary_Source_Dirs;
+ for Source_Dirs use ("src");

for Languages use
("Ada", "C")
@@ -41,8 +38,8 @@ library project Libadalang is
;

for Library_Dir use
- "../libadalang/" & Library_Kind_Param & "/" & Build_Mode;
- for Object_Dir use "../../obj/libadalang/" & Build_Mode;
+ "lib/" & Build_Mode;
+ for Object_Dir use "obj/" & Build_Mode;

Target := Libadalang'Target;
22 changes: 22 additions & 0 deletions utils/mains.gpr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- mains.gpr.old
+++ mains.gpr
@@ -1,4 +1,3 @@
-
with "langkit_support";
with "libadalang";

@@ -9,12 +8,10 @@

for Languages use ("Ada");

-
for Source_Dirs use (
- ".", "../../lal-21.0.0/ada/testsuite/ada", "../../lal-21.0.0/ada/testsuite/ada/gnat_compare"
+ "src-mains"
);
- for Exec_Dir use "../bin";
- for Object_Dir use "../obj/mains";
+ for Object_Dir use "obj-mains";

for Main use (
"gnat_compare.adb", "nameres.adb", "navigate.adb", "parse.adb"
46 changes: 46 additions & 0 deletions utils/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#! /bin/sh

set -e

RELEASE=21.0.0
SRC_PKG=/tmp/libadalang-$RELEASE.tar.gz

# Make sure the appropriate Langkit sources are checked out in
# /tmp/langkit-$RELEASE and Libadalang sources in /tmp/lal-$RELEASE
SRC_DIR=/tmp/lal-$RELEASE
cd $SRC_DIR
export PYTHONPATH=/tmp/langkit-$RELEASE:$PYTHONPATH

BUILD_DIR=/tmp/libadalang-$RELEASE
rm -rf $BUILD_DIR

# Generate the Libadalang and Mains projects
ada/manage.py --build-dir=$BUILD_DIR --no-langkit-support generate

# Reorganize the trees for libadalang.gpr
mv $BUILD_DIR/lib/gnat/libadalang.gpr $BUILD_DIR/
patch -d $BUILD_DIR -p0 -f -i $SRC_DIR/utils/libadalang.gpr.patch

mv $BUILD_DIR/include/libadalang.h $BUILD_DIR/src/
mv $BUILD_DIR/include/libadalang/*.ad* $BUILD_DIR/src/
mv $BUILD_DIR/include/libadalang/*.c $BUILD_DIR/src/
cp -a $SRC_DIR/ada/extensions/src/* $BUILD_DIR/src/

# Reorganize the trees for mains.gpr
mv $BUILD_DIR/src/mains.gpr $BUILD_DIR/
patch -d $BUILD_DIR -p0 -f -i $SRC_DIR/utils/mains.gpr.patch

mkdir $BUILD_DIR/src-mains
mv $BUILD_DIR/src/parse.adb $BUILD_DIR/src-mains/
cp -ar $SRC_DIR/ada/testsuite/ada/*.ad* $BUILD_DIR/src-mains/
cp -ar $SRC_DIR/ada/testsuite/ada/gnat_compare/*.ad* $BUILD_DIR/src-mains/

mv $BUILD_DIR/bin/lal_playground $BUILD_DIR/python
rm -r $BUILD_DIR/bin
rm -r $BUILD_DIR/include
rm -r $BUILD_DIR/lib
rm -r $BUILD_DIR/obj

# Create the release tarball
tar czf $SRC_PKG -C /tmp libadalang-$RELEASE
sha512sum $SRC_PKG

0 comments on commit 04b7560

Please sign in to comment.