How do I specify where the dsc, build, changes, update, tar.gz files go when running debuild? - build

Once in a while I like to send a version of my software to my Ubuntu PPA on Launchpad. To do so, I need to regenerate the source, description, and change files. To do that, I run the following command:
debuild -S -sa -nc -m"alexis#example.com"
The problem is that it spits out all the files one directory up from my main folder. So say I am working on a project named Beautiful, I would see:
projects/
projects/Beautiful/
projects/Beautiful/<source files from my git>
projects/Beautiful_1.2.3~xenial.dsc
projects/Beautiful_1.2.3~xenial_source.build
projects/Beautiful_1.2.3~xenial_source.changes
projects/Beautiful_1.2.3~xenial_source.ppa.upload
projects/Beautiful_1.2.3~xenial.tar.gz
I would like to place all of the source files in a sub-folder such as:
projects/
projects/Beautiful/
projects/Beautiful/<source files from my git>
projects/Beautiful_source/Beautiful_1.2.3~xenial.dsc
projects/Beautiful_source/Beautiful_1.2.3~xenial_source.build
projects/Beautiful_source/Beautiful_1.2.3~xenial_source.changes
projects/Beautiful_source/Beautiful_1.2.3~xenial_source.ppa.upload
projects/Beautiful_source/Beautiful_1.2.3~xenial.tar.gz
Is it possible from the command line or a rule somewhere? Or is the one directory up the only place where debuild will work on that?

Related

A smarter clang-tidy run: only check changed files & other source files that include a changed header?

We use the run-clang-tidy script to check the whole component after a build like so:
run-clang-tidy-12 -p build -header-filter="(src|libraries)" src libraries
We would like to run this (by changing the parameters) only on the files that are changed and for all source files that include a changed header file. As we're using git, maybe together with gcc it can give use that list of files.
Thanks!

Embedding files in an iOS app (C++/Qt/cmake)

In an iOS c++/Qt application, I need to ship a few files and to keep them in their directory structure.
For the Android version, we bundle a zip which we unzip on the target before creating the QApplication.
On iOS, it seems that CMake is not capable of bundling files in a tree:
https://cmake.org/cmake/help/latest/prop_tgt/RESOURCE.html#prop_tgt:RESOURCE
https://cmake.org/cmake/help/latest/prop_sf/MACOSX_PACKAGE_LOCATION.html
I am not sure if this is a limitation of cmake or if this is a global limitation on iOS.
From the docs about iOS bundles:
It uses a relatively flat structure with few extraneous directories in an effort to save disk space and simplify access to the files.
What would be the preferred approach?
Is there a solution to ship the files from CMake directly?
If not, how can I achieve this so that they are available before the QApplication is created?
The xcode command
Thanks to #Cy-4AH, I added the folder in Xcode and could get the command to do this:
CpResource _PATH_TO_DIRECTORY_ _APP_BUNDLE_DIRECTORY_/_RESOURCE_DIR_NAME_
cd /Users/denis/opt/qfield/ios/QField
export PATH="....."
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -strip-debug-symbols -strip-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -resolve-src-symlinks _PATH_TO_DIRECTORY_ _APP_BUNDLE_DIRECTORY_
But how can I create this from cmake? builtin-copyis an xcode command.
Simple system copy command
From an old (2008) discussion, we could use simple cp commands.
This works up to signing, but then I get an error unsealed contents present in the bundle root.
From this answer, it seems related that I cannot simply add folders in the resource directory. From the docs anatomy of framework bundles: Nonlocalized resources reside at the top level of the Resources directory
(Disclaimer: I'm not a CMake user, and there may be a more CMake-ey way to do this)
If you can set up post-build action, the following terminal script can efficiently sync files into your bundle from another location. I use it in my game engine because it only copies updated or new files upon subsequent builds, and preserves directory structure:
mkdir -p PATHTO/ORIGINFOLDERNAME
mkdir -p PATHTOBUILDFOLDER/PROJECTNAME.app/Contents/Resources/DESTINATIONFOLDERNAME
rsync -avu --delete --exclude=".*" PATHTO/ORIGINFOLDERNAME/ PATHTOBUILDFOLDER/PROJECTNAME.app/Contents/Resources/DESTINATIONFOLDERNAME
The mkdir commands are only to ensure that the folders are generated, if they were deleted.
So apparently the CMake method also works for directories.
target_sources(${QT_IOS_TARGET} PRIVATE ${_resource})
set_source_files_properties(${_resource} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
It will just be added at the root directory of the bundle and not within the Resources.
If the embedded file is not too big, you might consider :
in your source tree, generating a C++ file embedding that file as a constant array. For example, if your file contains just hello, world with a new line, you could have something like
/// file contents.cc
const char file_contents[] = "hello, world\n";
and at the beginning of your program (perhaps in your main function, before your QApplication) call a C++ function which writes such a file (perhaps in /tmp/).
in your build automation (e.g your Makefile or your qmake things), have something which generates the C++ contents.cc file from the genuine source
This is with a POSIX/Linux point of view, adapt my answer to your iOS.

Using %{buildroot} in a SPEC file

I'm creating a simple RPM installer, I just have to copy files to a directory structure I create in the %install process.
The %install process is fine, I create the following folder /opt/company/application/ with the command mkdir -p %{buildroot}/opt/company/%{name} and then I proceed to copy the files and subdirectories from my package. I've tried to install it and it works.
The doubt I have comes when uninstalling. I want to remove the folder /opt/company/application/ and I thought you're supposed to use %{buildroot} anywhere when referencing the install location. Because my understanding is the user might have a different structure and you can't assume that rmdir /opt/company/%{name}/ will work. Using that command in the %postun section deletes succesfully the directories whereas using rmdir ${buildroot}/opt/company/%{name} doesn't delete the folders.
My question is, shouldn't you be using ${buildroot} in the %postun in order to get the proper install location? If that's not the case, why?
Don't worry about it. If you claim the directory as your own in the %files section, RPM will handle it for you.
FYI, %{buildroot} probably won't exist on the target machine.

Understanding of usage of Java2Wsdl for axis2/c

I have a problem with the installation of Java2Wsdl tool.
I have succesfully created and compiled(generated the .class file from the .java file) a simple Java class inside a directory /home/user/examples/com/mycompany/app.
In there I compile my SimpleClass and so, I have two files: SimpleClass.java & a SimpleClass.class .
Next, I have axis2/c installed on my ubuntu system
$ echo $AXIS2C_HOME
/usr/local/axis2c
I also have axis2/java installed
echo $AXIS2_HOME
/opt/axis2-1.6.2
I also downloaded, extracted and installed from this link the java2wsdl plugin.
This is how the bin directory looks like.
username#usernamePC:/opt/axis2-1.6.2/bin$ ls
axis2.bat axis2server.sh java2wsdl.bat setenv.sh wsdl2java.sh
axis2server.bat axis2.sh java2wsdl.sh wsdl2java.bat
Now, I want to convert my initial project from java to wsdl with java2wsdl but I cannot understand the right place of directory I should put that into, if I have the classpath(?) right and what would be the correct command for the conversion to happen.
I am trying something like that: Java2WSDL.sh -cn com.mycompany.app.SimpleClass
In here I put . instead of / and I am typing that in top directory, meaning com directory.
Can you help me out with this?
I am sorry for the long question but I needed to set all things right.
my-app was build with a simple maven project (maven 2.2.1) through this guide.
You should start codegeneration from build/classes directory.
That directory must have com and META-INF subdirs.
Example of generating WSDL:
# compile your project using ant or mvn
ant
# go to binary dir
cd build/classes
# check SimpleClass.class is here
ls com/mycompany/app/SimpleClass.class
# generate WSDL into current directory
$AXIS2_HOME/bin/java2wsdl.sh -cn com.mycompany.app.SimpleClass
# see generated WSDL
cat SimpleClass.wsdl
To generate WSDL into different directory append -o <directory> switch to command line of wsdl2java.sh script.

Xcode 4 file input/output, command line tool C++

I'm trying to figure out where to save multiple .txt files so that i can have a command line tool project in Xcode read directly in from them while running it.
I understand that Xcode compiles everything to a folder, DerivedData, which i have saved in the same location as my source code for each project respectively.
can i save multiple .txt files anywhere in the DerivedData folder or include it in the build settings and phases so that when i run the command line tool i can type the name of a file, it will read in from that file.
By default the compiled/linked binary will look into its own directory for files.
For example, my binaries are at ProjectName/Build/Products/Debug/ and therefore it will look for files from that dir.
You can use relative path from that folder to the outside.
Or, you can create a symbolic link to another directory (on Terminal):
ln -s source_dir target_file
target_file must be located in the same directory as your binary. And you can reference the other files like "target_file/file1.txt", etc.