Skip to content

Commit 91b9999

Browse files
committed
updated rpm create packages
1 parent 1c976ca commit 91b9999

File tree

7 files changed

+448
-30
lines changed

7 files changed

+448
-30
lines changed

doc/SmallTextPadLicense.txt

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
SmallTextPad - License
2-
3-
SmallTextPad is under a Freeware License Agreement (the "Agreement") is a legal agreement
4-
between you ("Licensee"), the end-user, and wagemaker.co.uk for the use of this software product
5-
("SmallTextPad") on non-commercial and for which source code is not available. According
6-
to the Free Software Foundation (FSF), "freeware" is a loosely defined category and it has
7-
no clear accepted definition, although FSF asks that free software such as (libre; unrestricted
8-
and with source code available) should not be called freeware.
1+
MIT License
2+
3+
Copyright (c) 2021 Ricardo Wagemaker
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
923

1024
3rd Party - License
1125

package.sh

100644100755
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ javac -d bin @sources.txt
2525
echo "[run] Now creating SmallTextPad.jar in the current directory"
2626
jar cfm classes/artifacts/SmallTextPad.jar src/META-INF/MANIFEST.MF -C bin . -C . res -C . dic
2727

28-
echo "[run] Now creating smalltextpad_<version>_amd64.snap in the current directory"
29-
snapcraft pack --output=classes/artifacts/smalltextpad_$(grep '^version:' snap/snapcraft.yaml | awk '{print $2}' | tr -d "'")_amd64.snap
28+
echo "[run] Now testing newly created SmallTextPad.jar"
29+
java -jar classes/artifacts/SmallTextPad.jar
30+
31+
# echo "[run] Now creating smalltextpad_<version>_amd64.snap in the current directory"
32+
# snapcraft pack --output=classes/artifacts/smalltextpad_$(grep '^version:' snap/snapcraft.yaml | awk '{print $2}' | tr -d "'")_amd64.snap
3033

3134

3235

packaging/README-rpm.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# RPM Packaging for SmallTextPad
2+
3+
This directory contains the RPM packaging files for SmallTextPad, a lightweight Java text editor with encryption and multi-language support.
4+
5+
## Files
6+
7+
- `smalltextpad.spec` - RPM spec file with complete package definition
8+
- `build-rpm.sh` - Helper script to build the RPM package
9+
- `README-rpm.md` - This documentation file
10+
11+
## Prerequisites
12+
13+
### System Requirements
14+
- Linux distribution with RPM package management (Fedora, RHEL, CentOS, openSUSE, etc.)
15+
- Java 21+ JDK installed
16+
- RPM build tools
17+
18+
### Installing Build Dependencies
19+
20+
**Fedora/RHEL/CentOS:**
21+
```bash
22+
sudo dnf install rpm-build rpmdevtools java-21-openjdk-devel
23+
```
24+
25+
**openSUSE:**
26+
```bash
27+
sudo zypper install rpm-build java-21-openjdk-devel
28+
```
29+
30+
## Building the RPM Package
31+
32+
1. Navigate to the packaging directory:
33+
```bash
34+
cd packaging
35+
```
36+
37+
2. Run the build script:
38+
```bash
39+
./build-rpm.sh
40+
```
41+
42+
The script will:
43+
- Set up the RPM build environment
44+
- Create a source tarball
45+
- Build both binary and source RPM packages
46+
47+
## Package Details
48+
49+
### Package Information
50+
- **Name:** smalltextpad
51+
- **Version:** 1.5.0
52+
- **Architecture:** noarch (Java application)
53+
- **License:** Custom (see LICENSE file)
54+
- **URL:** https://github.com/gcclinux/smalltextpad
55+
- **Maintainer:** Ricardo Wagemaker
56+
57+
### Installation Locations
58+
- **Executable:** `/usr/bin/smalltextpad`
59+
- **JAR file:** `/usr/share/smalltextpad/SmallTextPad.jar`
60+
- **Resources:** `/usr/share/smalltextpad/res/`
61+
- **Dictionaries:** `/usr/share/smalltextpad/dic/`
62+
- **Desktop file:** `/usr/share/applications/smalltextpad.desktop`
63+
- **Icons:** `/usr/share/icons/hicolor/{128x128,256x256,1024x1024}/apps/smalltextpad.png`
64+
- **Documentation:** `/usr/share/doc/smalltextpad/`
65+
66+
### Features Included
67+
- Desktop integration with application menu entry
68+
- File associations for text files and .sstp encrypted files
69+
- Multiple icon sizes for different display densities
70+
- Proper MIME type handling
71+
- Multi-language desktop entry descriptions
72+
- Automatic icon cache and desktop database updates
73+
74+
## Installing the Package
75+
76+
After building, install the package with:
77+
78+
```bash
79+
# Using rpm directly
80+
sudo rpm -ivh ~/rpmbuild/RPMS/noarch/smalltextpad-1.5.0-1.*.noarch.rpm
81+
82+
# Or using dnf (Fedora/RHEL)
83+
sudo dnf install ~/rpmbuild/RPMS/noarch/smalltextpad-1.5.0-1.*.noarch.rpm
84+
85+
# Or using zypper (openSUSE)
86+
sudo zypper install ~/rpmbuild/RPMS/noarch/smalltextpad-1.5.0-1.*.noarch.rpm
87+
```
88+
89+
## Using the Application
90+
91+
Once installed, you can:
92+
93+
1. **Launch from application menu:** Look for "SmallTextPad" in the Office or Development category
94+
2. **Launch from command line:** `smalltextpad [filename]`
95+
3. **Open files:** Right-click text files and choose "Open with SmallTextPad"
96+
97+
## Uninstalling
98+
99+
```bash
100+
sudo rpm -e smalltextpad
101+
# or
102+
sudo dnf remove smalltextpad
103+
# or
104+
sudo zypper remove smalltextpad
105+
```
106+
107+
## Customization
108+
109+
### Modifying the Spec File
110+
111+
The `smalltextpad.spec` file can be customized for different requirements:
112+
113+
- **Dependencies:** Modify the `Requires:` lines to change Java version requirements
114+
- **File locations:** Change installation paths in the `%install` section
115+
- **Desktop integration:** Modify the desktop file creation in the `%install` section
116+
- **Package metadata:** Update summary, description, and other metadata
117+
118+
### Building for Different Architectures
119+
120+
While SmallTextPad is a Java application (noarch), you can modify the spec file to build architecture-specific packages if needed by changing:
121+
```spec
122+
BuildArch: noarch
123+
```
124+
125+
## Troubleshooting
126+
127+
### Common Issues
128+
129+
1. **Java not found during build:**
130+
- Ensure Java 21+ JDK is installed
131+
- Check that `java` and `javac` are in your PATH
132+
133+
2. **RPM build tools missing:**
134+
- Install `rpm-build` and `rpmdevtools` packages
135+
136+
3. **Permission errors:**
137+
- Ensure you have write permissions to `~/rpmbuild/`
138+
- The build script will create the directory structure if needed
139+
140+
4. **Missing MANIFEST.MF:**
141+
- The build script automatically creates this file if missing
142+
143+
### Build Logs
144+
145+
Check RPM build logs for detailed error information:
146+
```bash
147+
tail -f ~/rpmbuild/BUILD/smalltextpad-*/build.log
148+
```
149+
150+
## Contributing
151+
152+
To contribute improvements to the RPM packaging:
153+
154+
1. Fork the repository
155+
2. Make changes to the spec file or build scripts
156+
3. Test the build process
157+
4. Submit a pull request
158+
159+
## Support
160+
161+
- **Project Repository:** https://github.com/gcclinux/smalltextpad
162+
- **Issues:** https://github.com/gcclinux/smalltextpad/issues
163+
- **Latest Releases:** https://github.com/gcclinux/smalltextpad/releases/latest

packaging/build-rpm.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/bash
2+
# RPM build script for SmallTextPad
3+
# This script prepares the source tarball and builds the RPM package
4+
5+
set -euo pipefail
6+
7+
# Configuration
8+
PACKAGE_NAME="smalltextpad"
9+
VERSION="1.5.0"
10+
SPEC_FILE="smalltextpad.spec"
11+
12+
# Get script directory
13+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
14+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
15+
16+
echo "Building RPM package for $PACKAGE_NAME version $VERSION"
17+
18+
# Check if we're in the right directory
19+
if [[ ! -f "$PROJECT_ROOT/README.md" ]] || [[ ! -f "$PROJECT_ROOT/src/wagemaker/co/uk/main/Launcher.java" ]]; then
20+
echo "Error: This script must be run from the packaging directory of the SmallTextPad project"
21+
exit 1
22+
fi
23+
24+
# Check for required tools
25+
command -v rpmbuild >/dev/null 2>&1 || {
26+
echo "Error: rpmbuild not found. Please install rpm-build package:"
27+
echo " Fedora/RHEL/CentOS: sudo dnf install rpm-build rpmdevtools"
28+
echo " openSUSE: sudo zypper install rpm-build"
29+
exit 1
30+
}
31+
32+
command -v java >/dev/null 2>&1 || {
33+
echo "Error: java not found. Please install Java 21+ JDK:"
34+
echo " Fedora/RHEL: sudo dnf install java-21-openjdk-devel"
35+
echo " openSUSE: sudo zypper install java-21-openjdk-devel"
36+
exit 1
37+
}
38+
39+
command -v javac >/dev/null 2>&1 || {
40+
echo "Error: javac not found. Please install Java 21+ JDK (see above)"
41+
exit 1
42+
}
43+
44+
# Setup RPM build environment
45+
echo "Setting up RPM build environment..."
46+
rpmdev-setuptree 2>/dev/null || mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
47+
48+
# Create source tarball
49+
echo "Creating source tarball..."
50+
cd "$PROJECT_ROOT"
51+
TEMP_DIR=$(mktemp -d)
52+
SOURCE_DIR="$TEMP_DIR/$PACKAGE_NAME-$VERSION"
53+
54+
# Copy source files
55+
mkdir -p "$SOURCE_DIR"
56+
cp -r src dic res packaging snap doc "$SOURCE_DIR/" 2>/dev/null || true
57+
cp README.md LICENSE package.sh run.sh sources.txt "$SOURCE_DIR/" 2>/dev/null || true
58+
59+
# Create MANIFEST.MF if it doesn't exist
60+
if [[ ! -f "$SOURCE_DIR/src/META-INF/MANIFEST.MF" ]]; then
61+
mkdir -p "$SOURCE_DIR/src/META-INF"
62+
cat > "$SOURCE_DIR/src/META-INF/MANIFEST.MF" << 'EOF'
63+
Manifest-Version: 1.0
64+
Main-Class: wagemaker.co.uk.main.Launcher
65+
Class-Path: .
66+
EOF
67+
fi
68+
69+
# Create tarball
70+
cd "$TEMP_DIR"
71+
tar czf "$PACKAGE_NAME-$VERSION.tar.gz" "$PACKAGE_NAME-$VERSION"
72+
73+
# Copy to RPM SOURCES
74+
cp "$PACKAGE_NAME-$VERSION.tar.gz" ~/rpmbuild/SOURCES/
75+
76+
# Copy spec file
77+
cp "$SCRIPT_DIR/$SPEC_FILE" ~/rpmbuild/SPECS/
78+
79+
# Clean up temp directory
80+
rm -rf "$TEMP_DIR"
81+
82+
# Build RPM
83+
echo "Building RPM package..."
84+
cd ~/rpmbuild/SPECS
85+
rpmbuild -ba "$SPEC_FILE"
86+
87+
echo ""
88+
echo "Build completed successfully!"
89+
echo "RPM packages are available in:"
90+
echo " Binary RPM: ~/rpmbuild/RPMS/noarch/$PACKAGE_NAME-$VERSION-1.*.noarch.rpm"
91+
echo " Source RPM: ~/rpmbuild/SRPMS/$PACKAGE_NAME-$VERSION-1.*.src.rpm"
92+
echo ""
93+
echo "To install the package:"
94+
echo " sudo rpm -ivh ~/rpmbuild/RPMS/noarch/$PACKAGE_NAME-$VERSION-1.*.noarch.rpm"
95+
echo ""
96+
echo "Or on Fedora/RHEL systems:"
97+
echo " sudo dnf install ~/rpmbuild/RPMS/noarch/$PACKAGE_NAME-$VERSION-1.*.noarch.rpm"

0 commit comments

Comments
 (0)